daemon: a per-task stop does not interrupt a resumed run reacquiring capacity #1937

Closed
opened 2026-11-12 17:17:54 +00:00 by sam · 1 comment
Owner

After #1932, a run resumed from a call wait reacquires its slot under the call-wait watcher's context, so only daemon shutdown interrupts that wait. A per-task stop leaves it waiting until capacity frees. The run's own context cannot be stored on the hold (containedctx), so the dispatcher needs the run's cancellation passed through setCallWaits or a cancel signal on the hold.

Done when stopping a task whose run is waiting to reacquire returns that wait and releases its place.

After #1932, a run resumed from a call wait reacquires its slot under the call-wait watcher's context, so only daemon shutdown interrupts that wait. A per-task stop leaves it waiting until capacity frees. The run's own context cannot be stored on the hold (containedctx), so the dispatcher needs the run's cancellation passed through setCallWaits or a cancel signal on the hold. Done when stopping a task whose run is waiting to reacquire returns that wait and releases its place.
sam added the lowbug labels 2026-11-12 17:17:54 +00:00
sam added a new dependency 2026-11-13 02:51:02 +00:00
Author
Owner

Fixed in 7d6f22d2. The run now binds its per-task stop context to its hold (hold.bindStop, a done channel since containedctx forbids storing the context), and reacquire waits on that as well as the watcher context. takeSlotLocked now takes a context and returns when it ends (it previously ignored cancellation entirely, even on shutdown), so a stopped run's re-acquire returns the wait and releases its slot and repo place; Submit's initial slot wait gets the same. Not reproducible deterministically, so no test. Ran task check (passed).

Fixed in 7d6f22d2. The run now binds its per-task stop context to its hold (hold.bindStop, a done channel since containedctx forbids storing the context), and reacquire waits on that as well as the watcher context. takeSlotLocked now takes a context and returns when it ends (it previously ignored cancellation entirely, even on shutdown), so a stopped run's re-acquire returns the wait and releases its slot and repo place; Submit's initial slot wait gets the same. Not reproducible deterministically, so no test. Ran task check (passed).
sam closed this issue 2026-11-13 16:51:07 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1937