Repository navigation
EventHub: Port websocket robustness fixes from ayon-core - #386
Merged
Merged
Conversation
- Reconnect a working connection silently before reporting it as lost, emit 'connection.interrupted' instead. Server restart is still reported as closed right away. - Count receive timeouts instead of measuring wall-clock time, so a host holding the GIL does not make the connection look dead. - Block SIGPIPE in the websocket thread, some hosts reset it to the default action which terminates the process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BigRoy
reviewed
Nov 24, 2026
BigRoy
left a comment
Member
There was a problem hiding this comment.
Checked it against the ayon-core hub, the logic matches apart from _wait. One real issue (logout), the rest is small.
- Reconnect silently only while there is a token, logout closed the connection and was reported as 'connection.interrupted' with unknown state instead of 'connection.closed'. - Say in docstring that 'connection.interrupted' should be handled like 'connection.closed' by anything caching server data. - Timeout counting test now simulates GIL stall with a jumping clock, it passed with wall-clock based detection before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BigRoy
approved these changes
Nov 25, 2026
BigRoy
left a comment
Member
There was a problem hiding this comment.
Tested against a local server: GIL held 18 s / 60 s, proxy drop, proxy down, logout and server restart all report as described, and events keep arriving after each reconnect.
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.
Changelog Description
Port websocket fixes from the ayon-core event hub (
ayon_core/tools/common_models/websocket.py) toEventHub, so both implementations behave the same.New
connection.interruptedevent is emitted when a working connection drops and is reconnected silently. Anything that caches server data and resyncs onconnection.closedshould handleconnection.interruptedthe same way.Additional info
connection.interrupted(EventHub.TOPIC_CONNECTION_INTERRUPTED) and reconnects.connection.openedis emitted once reconnected,connection.closedonly if reconnecting fails. Server restart and logout (token removed) are still reported as closed right away.time.monotonic(). The thread might not run for a long time while messages are waiting in the socket, so wall-clock time made a stalled-but-alive connection look dead.Behavior change: listeners of
connection.closedwon't receive short drops anymore, andreconnect()called on an open connection emitsconnection.interruptedinstead ofconnection.closed.Testing notes:
pytest tests/test_event_hub_ping.py tests/test_event_hub_lifecycle.pyreset_token()) with the hub connected and checkconnection.closedis emitted.