question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When socket.io is under heavy / medium load it is sending a message to the wrong socket

See original GitHub issue

Describe the bug I noticed it while doing the load test. I have a multi-organizational application and I am using socket.io. A user of customer A joins room A, while user B only registers to room B. I prepared a load test scenario with Artillery, with a total of 7000 sockets for 10 minutes. I realized that some of the messages I just left in room A go to B users in an interesting way. There was this problem at socket.io 2.x, I upgraded it to 3.x today and the problem continues.

At first I suspected ID conflict, but I tried to override the io.engine.generateId and give myself longer UUIDs as a result I saw that the problem was not ID conflict.

To Reproduce If you prepare a load test with artillery and try a medium / heavy scenario, you may generate the error. Please fill the following code example:

Socket.IO server version: 3.0.5

Socket.IO client version: 3.0.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
llaaksocommented, Jan 18, 2021

socket.join is async and therefore causes such kind of problems. Maybe there is a good reason for such logic, however, I too once spent some time wondering why simple join room + emit won’t always work. Decided to ditch rooms and code own logic.

My experience was long time ago but sounds it still is the case.

0reactions
darrachequesnecommented, Jun 17, 2021

Closed as we were unable to reproduce, please reopen if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting connection issues | Socket.IO
First and foremost, please note that disconnections are common and expected, even on a stable Internet connection:
Read more >
Everything you need to know about Socket.IO - Ably Realtime
With sockets, when the server receives a new message it will send it to the client and notify them, bypassing the need to...
Read more >
Chat Rooms With Socket.io - Medium
It can send data back to the client independently without any requests. It's like a phone call. You don't have to wait for...
Read more >
Differences between WebSockets and Socket.IO - ITNEXT
Unlike WebSocket, Socket.IO allows you to broadcast a message to all the connected clients. · Proxies and load balancers make WebSockets hard to ......
Read more >
Realtime Chat With Users & Rooms - Socket.io, Node & Express
In this project we will build a chat app using Node, express & websockets in under 60 minutesCode:https://github.com/bradtraversy/chatcord  ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found