socket.io-redis-adapter icon indicating copy to clipboard operation
socket.io-redis-adapter copied to clipboard

Missing messages when dispatching to rooms

Open kiropowered opened this issue 3 years ago • 4 comments

Hello,

I actually use redis adapter to improve scalability of my websocket application. When dispatching a message to a room containing a user(client) sometime this message is not received. I tried to update to the latest version but the problem still occurs, without using the adapter it works as expected. It happens very randomly

Context Redis is configured have 2 servers, master and slave. Websocket application have 2 replicas

Lib versions socket.io : 4.5.1 @socket.io/redis-adapter: 7.2.0 redis: 4.0.6

This issue started to happen after upgrading the lib socketio from 2 to 4(following the upgrade instructions of course)

kiropowered avatar Jun 06 '22 19:06 kiropowered

I downgraded redis lib from 4.0.6 to 3.1.2 and I don't have the issue anymore. Is there something particular when using redis 4 instead of 3 ?

kiropowered avatar Jun 14 '22 19:06 kiropowered

@kiropowered there were quite a lot of changes in redis@4 so that might explain the issue.

Are you able to reliably reproduce the issue? In that case, could you please open an issue there will all necessary details?

darrachequesne avatar Jun 14 '22 23:06 darrachequesne

Hello @darrachequesne , Well I don't have any instructions to exactly reproduce the issue, but It happens quite often with lib 4. I saw there is a conditonnal check in socket.io-redis-adapter on redis version, no chance it comes from it ? Otherwise indeed it's definitly related to redis lib because I don't have the bug anymore

kiropowered avatar Jun 15 '22 12:06 kiropowered

@kiropowered i wonder if legacyMode: true on create client would fix the issue. I'm on v4 but havent encountered dropped messages yet but ill keep an eye out.

Most likely than note its probably something on this list: https://github.com/redis/node-redis/blob/master/docs/v3-to-v4.md

mgarf avatar Aug 18 '22 19:08 mgarf

I think this should be fixed now in the latest version of the redis package.

Please reopen if needed.

darrachequesne avatar May 02 '23 15:05 darrachequesne