You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm encountering an issue with the Socket.IO Client (version 4.7.5) when using emitWithAck in environments with unstable network connections.
When the client is disconnected and then reconnects (e.g., due to a brief backend outage), the event that was sent using emitWithAck gets emitted multiple times — specifically, it is emitted once initially and then three more times (matching the number of retries configured).
This leads to the server receiving and processing the same event multiple times after reconnection.
Steps to reproduce
Start the Socket.IO client with the configuration shown below.
Emit an event using emitWithAck.
Pause the backend Docker container to simulate a network failure.
Unpause the container to simulate reconnection.
Observe that the event is emitted multiple times after reconnection.
Regarding deduplication, I think that it should rather be handled by the user, for example by committing the event ID in the database, as part as the same transaction as the event handling, to ensure the event is handled exactly once by the server.
Hi @darrachequesne ,
Yes, I agree can handle deduplicating the requests on the backend using a UUID sent from the frontend. However, I’m struggling to see a valid reason for allowing the same request to be received 1 + x times (with retries). In my opinion, this behavior is prone to bugs unless someone has a deep understanding of how Socket.IO works under the hood.
This retry mechanism, especially when not properly acknowledged due to server load or network bottleneck, could lead to a thundering herd problem where multiple retries flood the server, compounding the initial issue.
Describe the bug
I'm encountering an issue with the Socket.IO Client (version 4.7.5) when using
emitWithAck
in environments with unstable network connections.When the client is disconnected and then reconnects (e.g., due to a brief backend outage), the event that was sent using
emitWithAck
gets emitted multiple times — specifically, it is emitted once initially and then three more times (matching the number of retries configured).This leads to the server receiving and processing the same event multiple times after reconnection.
Steps to reproduce
emitWithAck
.Client configuration
The text was updated successfully, but these errors were encountered: