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
Calls to disconnect doesn't stop reconnect #2010
Comments
can you try to set createClient({
socket: {
port: 65535,
keepAlive: false
}
})
|
Setting b5360c0 would fix the issue. Not sure how to write a test for that though. |
You can try to run redis own tests and try it. |
I have to say the v4 quality has been a disappointment, especially around the error handling of socket. |
Hello, i am facing the same issue, do you know when pixtron@b5360c0 will be merged ? |
I'm running in to this same issue. In the docs there is mention of two functions to disconnect. Quit and Disconnect. It says use disconnect to "Forcibly close a client's connection to Redis immediately" so that should cleanup all socket resources and stop retrying any connection. The disconnect promise resolves to undefined whether it actually does a disconnect or not. In my tests, the disconnect fails about 1 in 10 times. I guess I could wrap the redis client connection, mark it as "destroyed" and continuously call disconnect on every new received event until it shuts up, but I didn't expect to have to do this myself. |
After some analysis, I think I've found the issue. I don't think the PR will fix anything. The issue is the recursion with I also noticed a possible workaround to halt an infinite retry loop on a closed client. You can currently "short circuit" a reconnect routine by returning an Error object from the |
Hello, is there any update on this issue? |
With all due respect to the developers, the quality of the underlying connection code is poor in this library. If I had the time, I would fix these things myself, but considering the "redis" namespace that this package now has, I expect better quality from this library as it is the "official" node redis connector now. There is still an infinite loop and errors are not being caught properly. I love node and redis but I have migrated to ioredis (which has none of these issues) and I'm sorry to say that I will not use this package for the foreseeable future. |
@philip-nicholls I'm sorry you feel this way, the code was rewritten in #2295 (which was released in the last version). If you found a specific issue please share it. |
My code scenario is the following: this.instance = await createClient({
url: redisURL,
})
await this.instance.connect()
console.log('Redis connected', 'PING', await this.instance.ping())
this.instance.on('error', (err) => {
console.error('Redis Error', err)
this.instance.disconnect()
}) Steps to reproduce:
redis version 4.4.0 |
@pixtron I think that an "ongoing" |
If the connection to the redis server can't be established, a call to
client.disconnect()
won't stop the client from trying to reconnect.Steps to reproduce
65535
so the connection attempt errors withECONNREFUSED
SIGTERM
orSIGINT
to the process (eg. Ctrl + C)Expected Result
Client stops trying to reconnect and process ends.
Actual Result
The client keeps reconnecting, the process keeps running until a second
SIGTERM
orSIGINT
is sent (script only listens once to the event)Environment:
The text was updated successfully, but these errors were encountered: