Skip to content

Stop the client when an event handler raises - #74

Merged
FZambia merged 1 commit into
masterfrom
fuzz_fixes
Oct 14, 2026
Merged

FZambia merged 1 commit into
masterfrom
fuzz_fixes

Conversation

@FZambia

@FZambia FZambia commented Oct 14, 2026

Copy link
Copy Markdown
Member

Found while running the SDK fuzz programs.

Stop the client when an event handler raises

Handler exceptions used to be handled in three different ways:

  • While handling a server message, the client disconnected with bad protocol.
  • During a connection attempt or a teardown, they were logged and the client carried on.
  • From a state change inside connect(), subscribe() or unsubscribe(), the change completed and the call raised.

Now every exception escaping a handler fails the same loud way, as in centrifuge-js:

  • It is passed to the event loop's exception handler.
  • The client disconnects with bad protocol and doesn't reconnect.

The SDK's own work completes as if the handler had returned. A publication whose handler raised doesn't count as delivered, so a recovery delivers it again. The README section on callbacks that raise describes the behaviour.

Handler exceptions were handled in three ways: while handling a server
message the client disconnected with bad protocol; during a connection
attempt or a teardown they were logged and the client carried on; from a
state change inside connect(), subscribe() or unsubscribe() the change
completed and the call raised. Now every exception escaping a handler
fails the same loud way, as in centrifuge-js: it is passed to the event
loop's exception handler, and the client disconnects with bad protocol and
doesn't reconnect. The SDK's own work completes as if the handler had
returned, as for a handler calling disconnect(), and a publication whose
handler raised doesn't count as delivered, so a recovery delivers it again.

Handlers are called through a guard that looks them up at call time, so a
handler replaced on the handler object is still guarded. The README section
on callbacks that raise describes the behaviour.
@FZambia
FZambia merged commit 68379f7 into master Oct 14, 2026
11 checks passed
@FZambia
FZambia deleted the fuzz_fixes branch October 14, 2026 17:08
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