Skip to content

fix(adapter): do not skip local broadcast when publishAndReturnOffset throws#5457

Open
Not-Sarthak wants to merge 1 commit intosocketio:mainfrom
Not-Sarthak:fix/cluster-adapter-broadcast-error-handling
Open

fix(adapter): do not skip local broadcast when publishAndReturnOffset throws#5457
Not-Sarthak wants to merge 1 commit intosocketio:mainfrom
Not-Sarthak:fix/cluster-adapter-broadcast-error-handling

Conversation

@Not-Sarthak
Copy link

Summary

Fixes #5456

In ClusterAdapter.broadcast(), the catch block used return debug(...) which prevented super.broadcast(packet, opts) from ever being called when publishAndReturnOffset() rejected. This meant sockets connected to the same server instance that emitted the event would silently never receive it.

The fix removes the return keyword so that super.broadcast() is still called after logging the error — matching the pattern already used in addSockets, delSockets, and disconnectSockets.

  • Before: remote publish error → return debug(...)super.broadcast() skipped → local sockets get nothing
  • After: remote publish error → debug(...)super.broadcast() still runs → local sockets receive the event

Test plan

  • Added test case: "broadcasts to local clients even when publishAndReturnOffset throws"
  • All 48 existing adapter tests still pass
  • engine.io tests pass (189/189)
  • engine.io-client tests pass (93/93)

… throws

Remove the `return` in the catch block of ClusterAdapter.broadcast() so
that super.broadcast() is still called when remote publishing fails.
This ensures local sockets receive the event even if the cluster publish
errors out (e.g. due to a serialization error in the adapter layer).

Fixes socketio#5456
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.

ClusterAdapter.broadcast() silently drops events to local sockets when publishAndReturnOffset throws error

1 participant