Open Connections increasing
Problem
I am having two connections from nodejs to Redis: - one to set a list variable - to subscribe to a channel The longer the socket is running, the more connections I get. I have tried to set timeout values in redis, tried to close redis connections on close of socket.io [code block] So the connection in [code block] is always active and no problem whatsoever. But as time goes by the subscribed connections in [code block] increase, even if I unsubscribe on disconnect and on error. Any ideas? I have asked almost the same question on stackoverflow but got no answer as of yet. P.S.: sorry for my bad code and knowledge, this is my first nodejs ever.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Open Connections increasing
There're many potential reasons for your case. For example, there were many active socket.io connections not being closed, and the count of them kept increasing. You can add a counter that will be increased for new connections and be decreased for "disconnect" events to see whether the value of the counter meets your expectations.
Trust Score
1 verification
- 1
There're many potential reasons for your case. For example, there were many acti
There're many potential reasons for your case. For example, there were many active socket.io connections not being closed, and the count of them kept increasing. You can add a counter that will be increased for new connections and be decreased for "disconnect" events to see whether the value of the counter meets your expectations.
Validation
Resolved in redis/ioredis GitHub issue #952. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep