Repository navigation
feat(ipc): #85 abort in-flight handlers when the client disconnects — kill zombie commands - #1941
Merged
Merged
Conversation
… kill zombie commands Each IPC request is `rt_handle.spawn`'d detached and its JoinHandle dropped, so when the client disconnects mid-flight the handler kept running to completion — writing its answer into a dead socket. A long blocking command (a 60s ai/generate, a data scan) with no one left to answer is a zombie holding a lane + CPU. Fix: the per-connection reader now tracks its spawned command handles (reaping finished ones so the Vec stays bounded to what's actually in flight) and, on reader EOF (client gone), aborts any still-running handler — aborting an already-finished task is a harmless no-op. Composes with #86 by construction: a detached fire-and-poll job runs on its OWN `tokio::spawn` INSIDE the handler, so the command task tracked here has already returned the job handle — there is nothing to abort for it. Only abandoned BLOCKING requests are cancelled; long-running detached jobs survive the client leaving. Together #85+#86 make a multi-hour acting eval both survivable (detach) and non-zombie-ing (abort the abandoned blocking case). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each IPC request is
rt_handle.spawn'd detached and its JoinHandle dropped, so when the client disconnectsmid-flight the handler kept running to completion — writing its answer into a dead socket. A long blocking
command (a 60s ai/generate, a data scan) with no one left to answer is a zombie holding a lane + CPU.
Fix: the per-connection reader now tracks its spawned command handles (reaping finished ones so the Vec stays
bounded to what's actually in flight) and, on reader EOF (client gone), aborts any still-running handler —
aborting an already-finished task is a harmless no-op.
Composes with #86 by construction: a detached fire-and-poll job runs on its OWN
tokio::spawnINSIDE thehandler, so the command task tracked here has already returned the job handle — there is nothing to abort for it.
Only abandoned BLOCKING requests are cancelled; long-running detached jobs survive the client leaving. Together
#85+#86 make a multi-hour acting eval both survivable (detach) and non-zombie-ing (abort the abandoned blocking case).
Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo