-
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
After SUBSCRIBE in CLUSTER mode, an error is thrown when slots are refreshed #768
Comments
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. |
This issue hasn’t been fixed, stalebot. Please keep it open. |
@natesilva This issue should have been fixed in v4.0.1 (#697). Doesn't it work for you? |
I can’t reproduce the error now. We are using v4.5.1 and I was able to reproduce it recently with a minimal test case, but now I can’t. 🤷🏽♂️ Closing, will reopen if it happens again. |
@natesilva It is not possible to avoid "Unhandled error event" in combination redis cluster + used subscribe + cluster node or all nodes goes down. There is no bug in non-cluster version but only in cluster version. I will show you results for non-cluster version (single node on port 6379) and cluster version (with 2 nodes on ports 7008 and 7009). I also tested two alternatives "A" without subscribe and "B" with subscribe. Non-cluster (OK)Start redis single node, then run
// A - without subscribe:
// B - with subscribe:
There is no "Unhandled error event" in non-cluser version for both alternatives. Cluster (BUG)Start redis cluster, then run
// A - without subscribe:
No "Unhandled error event" in cluster version without subscribe. // B - with subscribe:
There is "Unhandled error event" in cluster version with subscribe alternative although all errors all correctly handled including that in subscribe callback. I think that it is unhandled by mistake somewhere in ioredis lib not by lib consumer. I also tried to listen for all cluster events but there is always this unhandled error. |
Maybe it will be usefull - similar Unhandled error events from linux - debian:
|
The errors will be caught by connection pool and a new election will be made when the current subscriber is lost, so we can safely ignore these errors. Fix #768
The errors will be caught by connection pool and a new election will be made when the current subscriber is lost, so we can safely ignore these errors. Fix #768
🎉 This issue has been resolved in version 4.6.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [4.6.1](redis/ioredis@v4.6.0...v4.6.1) (2019-01-29) ### Bug Fixes * **Cluster:** ignore connection errors for subscriber. ([#790](redis/ioredis#790)) ([f368c8a](redis/ioredis@f368c8a)), closes [#768](redis/ioredis#768)
When you have a CLUSTER connection and you issue the SUBSCRIBER command, ioredis continues to periodically refresh its slots cache by calling
CLUSTER slots
.When this happens, an error is thrown (see lib/redis.js line 571): https://github.com/luin/ioredis/blob/ec1e85267f79c31825a0340f981be94f8edbed2d/lib/redis.js#L570-L573
I don’t know Redis well enough to know if
CLUSTER slots
should be allowed here, but this seems like a bug: eitherCLUSTER slots
should be added to theVALID_IN_SUBSCRIBER_MODE
list, or it should stop refreshing slots once it’s in SUBSCRIBER mode.The text was updated successfully, but these errors were encountered: