Skip to content

Scope worker interrupts to the remotely-submitted work#192

Open
Keno wants to merge 2 commits into
JuliaLang:masterfrom
KenoAIStaging:kf/cancellation
Open

Scope worker interrupts to the remotely-submitted work#192
Keno wants to merge 2 commits into
JuliaLang:masterfrom
KenoAIStaging:kf/cancellation

Conversation

@Keno

@Keno Keno commented Jul 9, 2026

Copy link
Copy Markdown
Member

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.

Keno and others added 2 commits July 9, 2026 17:38
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
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.

1 participant