Skip to content

Make connection close the worker stop signal and fix shutdown hangs - #476

Closed
hermabr wants to merge 2 commits into
t3code/migrate-http-to-websocketsfrom
worker-stop-via-close
Closed

Make connection close the worker stop signal and fix shutdown hangs#476
hermabr wants to merge 2 commits into
t3code/migrate-http-to-websocketsfrom
worker-stop-via-close

Conversation

@hermabr

@hermabr hermabr commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Idle worker handlers block in lease_job without touching the socket, so
closing their connections never woke them: an interrupted run waited out
the 10s drain timeout and leaked non-daemon handler threads that hang
interpreter exit. Server shutdown now marks the coordinator finished
first, which wakes every waiting handler, and the run loop closes the
server before joining worker pools so pool stops only reap
already-exiting workers.

With that, the explicit stop/assign envelopes are unnecessary: the
server sends Job frames directly and a normal WebSocket close is the
stop signal, removing AssignMessage, StopMessage, their kind
discriminators, and the server message adapter.

Idle worker handlers block in lease_job without touching the socket, so
closing their connections never woke them: an interrupted run waited out
the 10s drain timeout and leaked non-daemon handler threads that hang
interpreter exit. Server shutdown now marks the coordinator finished
first, which wakes every waiting handler, and the run loop closes the
server before joining worker pools so pool stops only reap
already-exiting workers.

With that, the explicit stop/assign envelopes are unnecessary: the
server sends Job frames directly and a normal WebSocket close is the
stop signal, removing AssignMessage, StopMessage, their kind
discriminators, and the server message adapter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

hermabr commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

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