Skip to content

Handle WebSocket close during asynchronous callbacks - #3946

Open
buildinsilencedev wants to merge 1 commit into
tornadoweb:masterfrom
buildinsilencedev:websocket-close-independent
Open

buildinsilencedev wants to merge 1 commit into
tornadoweb:masterfrom
buildinsilencedev:websocket-close-independent

Conversation

@buildinsilencedev

Copy link
Copy Markdown

Fixes #3851.

This is an alternative to #3858 based directly on current Tornado master. It delivers close notification during pending asynchronous callbacks without cancelling the callbacks or changing application message order, and preserves handler state needed by a callback that resumes after close. Includes regression coverage for server-initiated close and callback rendering. An ordinary frame ahead of a close still waits for the pending callback to finish.

Validation on Linux, Python 3.14: the WebSocket suite ran 99 tests with 3 skips and no failures; git diff --check passed. The implementation and tests were prepared with AI assistance.

This branch has not been deployed

No deployments
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.

WebSocketHandler: surface connection close while open() or on_message() is still running

1 participant