You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WaitQueue#markNew returns a waiter to queued with no timeout armed #657
WaitQueue#markNew (src/leasing/wait-queue.ts:273) sets a waiter back to queued without calling #armTimeout (src/leasing/wait-queue.ts:371), which is only reached from enqueue (wait-queue.ts:246). A waiter whose timer already fired mid-attempt (the processing non-reject branch) and is then returned by markNew sits queued with timer === undefined and deadlineAt already past: no timer can reject it, and it is only settled if some later enqueue/markProcessing happens to run its deadline check. The lease coordinator's markNew callers are the eviction continue path and the provision-retry first failure, so a waiter on either can outlive its timeoutMs indefinitely.
The gap is named in the comment at wait-queue.ts:365-369 but has no issue. Its edge is a waiter past deadlineAt that nothing ever re-enqueues.
Could not reproduce on main (44290384, which includes #647's fix). No waiter is left queued with a past deadline and no armed timer, because both markNew callers decide the waiter again before the decision section ends, and every branch of that decision checks the deadline.
What I tried. Unit tests over LeaseAcquisitionCoordinator's own surface (FakeClock, its real WaitQueue, Registry on MemoryFilesystem), staging the processing non-reject branch by gating the eviction's driver call so the armed deadline expires mid-attempt. Both markNew call sites were reached, not modelled:
#provision's first-failure retry (lease-acquisition-coordinator.ts:849) — returns true, and await this.#drive(waiter) runs on the next line.
#continueAfterEviction (:1008) — markNew then return this.#decide(waiter) inside the same decisions.run.
In both, the caller got its error and the record closed:
Why the edge is unreachable.markNew does arm nothing, but the waiter never sits there: #decide reaches markProcessing (:886/:900) or #defer → #enqueue, and markProcessing runs the same #expireIfPastDeadline as enqueue (wait-queue.ts:254 vs :236). The window between markNew and that check is inside one synchronous section, so no caller, event or record can observe it. Nothing to reproduce means no failing test, so there is no bug/657-repro branch.
What would change this. A markNew caller that does not decide the waiter again in the same section — a third caller, or #decide returning before markProcessing/#defer for a waiter that has a spec (today it reaches both, or rejects). Then a queued waiter would keep its past deadline with no timer, as filed.
The comment this issue cites is wrong on its own; filed as #666. Two other things fell out of these runs: #665 (the operation branch at :900 discards markProcessing's false and provisions a device for a waiter already rejected with QueueTimeoutError — seen: ['provision@1160 waiter=rejected']), and the accepted-but-undocumented case where a first attempt plans device work immediately, so no timer is armed and a grant can land past timeoutMs (--timeout is documented as queue wait, so not filed).
Activity
V3RON commentedon Oct 17, 2026
Could not reproduce on
main(44290384, which includes #647's fix). No waiter is leftqueuedwith a past deadline and no armed timer, because bothmarkNewcallers decide the waiter again before the decision section ends, and every branch of that decision checks the deadline.What I tried. Unit tests over
LeaseAcquisitionCoordinator's own surface (FakeClock, its realWaitQueue,RegistryonMemoryFilesystem), staging theprocessingnon-reject branch by gating the eviction's driver call so the armed deadline expires mid-attempt. BothmarkNewcall sites were reached, not modelled:#provision's first-failure retry (lease-acquisition-coordinator.ts:849) — returnstrue, andawait this.#drive(waiter)runs on the next line.#continueAfterEviction(:1008) —markNewthenreturn this.#decide(waiter)inside the samedecisions.run.In both, the caller got its error and the record closed:
Why the edge is unreachable.
markNewdoes arm nothing, but the waiter never sits there:#decidereachesmarkProcessing(:886/:900) or#defer→#enqueue, andmarkProcessingruns the same#expireIfPastDeadlineasenqueue(wait-queue.ts:254vs:236). The window betweenmarkNewand that check is inside one synchronous section, so no caller, event or record can observe it. Nothing to reproduce means no failing test, so there is nobug/657-reprobranch.What would change this. A
markNewcaller that does not decide the waiter again in the same section — a third caller, or#decidereturning beforemarkProcessing/#deferfor a waiter that has aspec(today it reaches both, or rejects). Then a queued waiter would keep its past deadline with no timer, as filed.The comment this issue cites is wrong on its own; filed as #666. Two other things fell out of these runs: #665 (the operation branch at
:900discardsmarkProcessing'sfalseand provisions a device for a waiter already rejected withQueueTimeoutError—seen: ['provision@1160 waiter=rejected']), and the accepted-but-undocumented case where a first attempt plans device work immediately, so no timer is armed and a grant can land pasttimeoutMs(--timeoutis documented as queue wait, so not filed).Written by an agent.