feat(core): warn when a timeout cannot actually stop the job#64
Merged
Conversation
`timeout=300` reads as "this job stops after 300 seconds". On a sync job it does not: Chronis marks the job failed, fires on_failure and schedules the retry, but Python cannot kill a thread, so the function keeps running and holding whatever it holds. Users only discovered this when abandoned_threads started climbing. create_job now says so at the moment the timeout is set, and points at the two things that do stop the work: a timeout on the blocking call itself (requests.get(..., timeout=...)), or writing the job as async, where asyncio.wait_for is a genuine cancellation. Async jobs are not warned about — their timeout is real. Nor are functions this process does not know, which already get the "not registered here" warning and whose colour on the executing pod we cannot guess. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
timeout=300은 **"이 job은 300초 뒤 멈춘다"**로 읽힙니다. 그런데 sync job에선 멈추지 않습니다.Chronis는 만기 시 job을 FAILED로 표시하고,
on_failure를 호출하고, 재시도를 예약합니다 — 그런데 함수는 계속 돕니다. 파이썬은 스레드를 죽일 수 없으니까요. 즉 현재의timeout은 판정(verdict)이지 정지 버튼이 아닙니다.지금까지 사용자는 이 사실을
abandoned_threads가 쌓이기 시작할 때에야 알았습니다. 이제 타임아웃을 설정하는 그 순간 알려줍니다.동작
경고로 끝내지 않고 실제로 일을 멈추는 두 가지 방법을 함께 제시합니다.
경고하지 않는 경우
asyncio.wait_for가 진짜로 취소함. 문제 없음마지막 항목이 특히 중요합니다 — API 파드가 job을 만들고 워커 파드가 실행하는 정상 패턴에서, 생성 프로세스는 함수의 색깔을 알 수 없으므로 추측해서 경고하지 않습니다.
배경
이건 "언젠가
isolation=\"process\"를 만들면 해결될 문제"의 오늘 할 수 있는 정직한 몫입니다. 프로세스 격리가 생기면 경고에 그 선택지를 추가하면 됩니다. 그 전까지는 사용자가 timeout의 실제 계약을 알고 쓰는 게 맞습니다.테스트
docs/ARCHITECTURE_NOTES.md에 경고의 근거 기록🤖 Generated with Claude Code