ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

Why does my Redis disconnect then reconnect every 90 seconds?

Open rublev opened this issue 6 months ago • 2 comments

This happens basically every 90 seconds:

[SSE Utils] Connection error event: Event {isTrusted: true, type: 'error', target: EventSource, currentTarget: EventSource, eventPhase: 2, …}
[SSE Utils] Connection error occurred, EventSource might attempt reconnection.
[Stream Handler] SSE Error: A connection error occurred (may retry).
[SSE Utils] Connection opened successfully.
[Stream Handler] SSE Connection opened.
[Stream Handler] Raw message received: {event: 'connected', message: 'SSE connection established', channelName: 'DF:STAGE:0196d069-f2e9-76ad-8226-ee86e48c0cc2'}

I'm using render.com k/v to host a Redis instance. This does not happen in local development, it never disconnects then reconnects locally. Wondering if this is an issue with Render.com's service or ioredis.

Thanks!

rublev avatar May 14 '25 21:05 rublev

Does this happen on an active or inactive connection? It sounds like the server is closing it, possibly due to inactivity. You can try connecting with telnet or another client library like redis-py to confirm.

elena-kolevska avatar May 15 '25 09:05 elena-kolevska

Does this happen on an active or inactive connection? It sounds like the server is closing it, possibly due to inactivity. You can try connecting with telnet or another client library like redis-py to confirm.

Thanks Elena. How do I know if the connection is active or inactive? I open my chat session and I receive/send messages just fine, just every 90 seconds it disconnects and then reconnects. I connected via redis-cli but I'm not seeing any disconnects. Waited like 10 minutes after subscribing:

redis-cli -u "rediss://red-1241223123:[email protected]:6379"
virginia-keyvalue.render.com:6379> SUBSCRIBE NF:STAGING:dawgd8ha9wd87
1) "subscribe"
2) "NF:STAGING:dawgd8ha9wd87"
3) (integer) 1

rublev avatar May 15 '25 16:05 rublev