-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect event triggered multiple times #695
Comments
Could you post the code here that can reproduce the issue? |
Sure, this code produces several connect events maybe 10% or 20% of the time on 4.0.0 ( tested a few dozen times ) and only one event on 3.2.0 ( same amount of tries ) :
|
I get multiple on 3.2, similar code as above, just logging on the connect event. Local server has no requests on it, yet will spit out "New Redis Connection" several times in a brief ten minute window. |
Update, upgraded to 4.0.0 - and still am getting multiple (3 in about the same ten-minute window) |
Have listeners 'close' and 'connect', and this is what I see: So there is some TTL on the connection and it reestablishes? |
@callsea1 Can you test if you get the "Connected", with lazyConnect true in the configuration and use the connect method manually like in the following. ( i had issue with this code sometime not triggering connection, and this is why i started using the connect event )
|
@simondutertre I have moved on 😂 -- but not using a cluster, simply this: But I tried swapping in this package: https://www.npmjs.com/package/redis And the same behavior existed, closing and re-establishing a connection. These are the two most popular libraries... 🤔 |
@callsea1 Could you run |
@simondutertre I've tested locally using the following code: const Redis = require('ioredis')
const redis = new Redis.Cluster([{
port: 30001
}, {
port: 30002
}, {
port: 30003
}])
redis.on('connect', console.log.bind(console, 'abc')) Only one connect is emitted. Could you enable the debug mode |
here are the logs ( same code as above ), it appears that the multiple connections are caused by the node being empty, although the number of connection seem to be random ( 3 on this try, 1 on second ) :
|
I tried the |
This issue has been solved in v4.2.0. Feel free to reopen this issue if the issue still exists. |
this is not fixed. please reopen this issue @luin |
@callsea1 That may be a different issue. Could you enable the debug mode (DEBUG=ioredis:* node yourapp.js) and post the logs here? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 7 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
@luin i am using version "ioredis": "^4.3.0" and still getting this error. |
ioredis:cluster:connectionPool Reset with [ { port: 8000, host: '127.0.0.1', password: '123' }, |
still have this issue in 4.16.3 @luin |
still have the same issue.. |
Hi,
I see that the connect event is triggered multiple times on 4.0.0 version and apparently just once in 3.2.2
Can you confirm that this is the case ?
Thanks!
The text was updated successfully, but these errors were encountered: