Repository navigation
Watch: an emitter that dies before the first liveness tick is never reported - #1064
loonister1 wants to merge 3 commits into
Conversation
Liveness could only report a thread that a previous tick had recorded as alive, so an emitter that stopped between being scheduled and the first tick was never recorded and could never be reported. inotify watch exhaustion fails exactly there: the watcher kept running, health kept saying "alive", and that directory was never watched. A stopped thread with an ident has run, which separates the corpse from the emitter caught between construction and start without needing a tick to have seen it alive.
Pins the case the liveness check could not reach: a scheduled watch whose emitter stops before any tick sees it alive is noticed and rescheduled instead of leaving the directory unwatched behind a healthy status.
|
Thank you for this PR. You found a real problem in the watcher. I ran your new test on the old base and on The fix is already on So I will not merge this PR. I will close it because the fix is already in. Thank you again for your help. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the fix addressing watch threads that stop before the first liveness check.
No open issues 🎉
What changed in this PR
Fixes #891 by detecting watch threads that ran and stopped before the first liveness check, allowing them to enter the existing recovery and reporting path.
Changes:
- Uses thread identity instead of previously observed liveness to detect stopped threads, while still ignoring unstarted threads.
- Adds a regression test confirming an early emitter death triggers rescheduling.
- Documents the fix in the changelog.
| File | Description |
|---|---|
tests/test_watch_robustness.py |
Tests emitter death before the first liveness check. |
code_review_graph/incremental.py |
Detects stopped threads without requiring a prior live observation. |
CHANGELOG.md |
Records the early emitter-death detection fix. |
Review effort: Balanced
check_livenessnow distinguishes a thread that never ran (ident is None, still not a corpse) from one that ran and stopped, instead of requiring a previous tick to have recorded it alive. That closes the hole where an emitter dying between scheduling and the first tick could never be recorded as live and therefore never as dead, so a registration-time failure such as inotifyENOSPCnow reaches the existing reschedule-once-then-report path rather than leaving a directory unwatched behind a healthycrg-daemon status.Fixes #891
Testing
[targeted; 3 commit(s) checked individually] $ /Users/m2/Documents/PW/github-bot/work/tirth8205__code-review-graph/891/.venv/bin/python -m pytest -q --no-header tests/test_incremental.py tests/test_watch_robustness.py
Notes for reviewers
Three things to check, in order.