Skip to content

fix(base/worker): guard cleanup-triggered early drop against in-flight requests - #753

Merged
nyannyacha merged 3 commits into
mainfrom
ny/fix/idle-cleanup-race
Oct 19, 2026
Merged

nyannyacha merged 3 commits into
mainfrom
ny/fix/idle-cleanup-race

Conversation

@nyannyacha

Copy link
Copy Markdown
Contributor

Description

TryCleanupIdleWorkers decided a worker had no pending work purely from
req_ack_count == req_demand, which is trivially true both right after
boot (both still 0) and in the brief gap between one request's ack and
the next one's delivery. A cleanup sweep landing in that window could
retire the isolate before an already-routed request ever reached it,
surfacing as a 504 to the caller.

Require the worker to have stayed caught-up for a short grace period
(cleanup_idle_grace, default 100ms, overridable via
context.supervisor.cleanupIdleGraceMs) before allowing a
cleanup-triggered drop.

@nyannyacha
nyannyacha merged commit 3d36f7e into main Oct 19, 2026
42 of 43 checks passed
@nyannyacha
nyannyacha deleted the ny/fix/idle-cleanup-race branch October 19, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants