Scope worker interrupts to the remotely-submitted work#192
Open
Keno wants to merge 2 commits into
Open
Conversation
Under Julia's cancellation machinery (JuliaLang/julia#60281 rework), a SIGINT cancels the process's current ^C-episode source, and everything spawned from a worker's toplevel - including its message-serving infrastructure - inherits the startup episode's scope. An `interrupt(pid)` therefore tore down the worker's connection-serving tasks along with the in-flight work, leaving the worker alive but unable to respond. Detach the startup episode in `init_worker` and manage the ^C episode around the remotely-submitted work instead: while at least one request executes, an episode source is installed and every request thunk runs in its scope, so an interrupt cancels exactly the in-flight requests (each failing with a `RemoteException` wrapping the `CancellationRequest`); when the last request completes the episode is closed, making an interrupt of an idle worker a no-op. Responses are delivered outside the scope, where the level-triggered cancellation of the request they report cannot abort them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015KLwCBAR64r3cTdfaC5krU
The worker-side interrupt scoping references Base.CancellationToken and the ^C episode machinery, which exist only on Julia 1.14-DEV with the cancellation rework; older Julia versions cannot load the package. Bump the package version and tighten the compatibility bound accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015KLwCBAR64r3cTdfaC5krU
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.
Under Julia's cancellation machinery (JuliaLang/julia#60281 rework), a SIGINT cancels the process's current ^C-episode source, and everything spawned from a worker's toplevel - including its message-serving infrastructure - inherits the startup episode's scope. An
interrupt(pid)therefore tore down the worker's connection-serving tasks along with the in-flight work, leaving the worker alive but unable to respond.Detach the startup episode in
init_workerand manage the ^C episode around the remotely-submitted work instead: while at least one request executes, an episode source is installed and every request thunk runs in its scope, so an interrupt cancels exactly the in-flight requests (each failing with aRemoteExceptionwrapping theCancellationRequest); when the last request completes the episode is closed, making an interrupt of an idle worker a no-op. Responses are delivered outside the scope, where the level-triggered cancellation of the request they report cannot abort them.