Repository navigation
fix(scheduler): reap hung fires past FireDeadline (Fixes #2588) - #2631
jayunit100 wants to merge 4 commits into
Conversation
…eld lease When Singleton schedules hung past their explicit FireDeadline, stale-fire reconciliation must not treat a still-held session lease as "live" forever. Adds regression tests for issue stacklok#2588. Co-authored-by: Cursor <[email protected]>
…lok#2588) Add searchable diagnostics and a distinct terminal fire Err when reaping hung in-flight fires past FireDeadline; extend regression test coverage. Co-authored-by: Cursor <[email protected]>
Allow stale-fire reconciliation while a hung fire is still in flight; fix Issue2588 log test to use capturingDiag.msgs. Co-authored-by: Cursor <[email protected]>
|
Hi @jayunit100 , thanks a lot for reporting this and for putting the PR together, and sorry it took us so long to get back to you. The write-up made it easy to dig in, and a scheduler that heals itself is exactly what we want. I reproduced it locally. On current Why reaping past the deadline isn't enough. The lease is held because the fire is still in progress in the process. The fire function is blocked, and it releases the lease only when it returns. So reaping it:
There is also a smaller issue. With the unlock moved into The real cause: your second suggestion. When a schedule's origin session is idle, the "fire started" notice runs a full turn in that session ( Suggested fix. Move only the origin session's run off the fire path:
The Tests that would show it works:
We'll track the case where the fire's own run ignores cancellation in #2955, so there's no need to cover it here. Happy to answer questions or take an early look while you're on it. One question: was the stuck schedule created from a chat, so that it has an origin session? If not, the hang is somewhere else, for example the fire's own run ignoring cancellation, and the logs around the stuck fire would help. The issue mentions v0.0.47, which predates #2277, so a repro on a recent build would be great. Thanks again! |
|
It was from a chat yup |
|
Thanks for confirming, @jayunit100! That matches what I reproduced. With an origin session, the fire waits for the "fire started" turn in the chat, and v0.0.47 already has that same path, so it fits your version too. Two small updates since my last comment:
We'll take a look whenever you update the PR, and I'm happy to help if anything is unclear. |
Summary
FireDeadlinelapses even when the prior session lease is still held, so singleton schedules are not stuck skipping every tick (production incident in Scheduler: hung schedule fire never reaped past Deadline; Singleton schedule stalls #2588).Errwhen this path runs (reconcile stale fire past FireDeadline (issue #2588)).Context
Patch, tests, and comments were drafted in Cursor (Composer 2.5 Fast) from the production write-up; please treat CI as the final validation gate.
Fixes #2588
Test plan
go test ./internal/adapter/scheduler/ -run 'Issue2588|ReconcileStaleFire' -count=1go test ./internal/app/ -run Issue2588 -count=1 -timeout 2mTestReconcileStaleFireLiveNotReconciledstill passes (noFireDeadline→ lease gate unchanged)Made with Cursor