When socket.io is under heavy / medium load it is sending a message to the wrong socket
See original GitHub issueDescribe 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:
- Created 3 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top GitHub Comments
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.
Closed as we were unable to reproduce, please reopen if needed.