-
Notifications
You must be signed in to change notification settings - Fork 484
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
Unable to catch ECONNRESET error and it is causing app to crash. #412
Comments
Hi! Something like: const namespaces = io.nsps;
Object.keys(namespaces).forEach((namespaceName) => {
io.of(namespaceName).adapter.on('error', (e) => {
console.error(`On namespace: ${namespaceName} - ${e}`);
});
}); Hope this helps! |
Thank you but why is my io.nsps undefined? |
Previously, the "error" events from the two Redis clients were forwarded by each instance of the adapter, which made it quite hard to handle the errors with a lot of namespaces (as there is one instance of adapter per namespace). ```js io.of("/my-namespace").adapter.on("error", () => { // ... }); ``` The adapter instance will no longer emit "error" events, and will print a warning if there is no other error handler registered (for backward compatibility). The error handling must be done directly on the Redis client: ```js redisClient.on("error", (err) => { // something went wrong, maybe the connection to the server was lost }); ``` Related: - #412 - #425
For future readers: This should be fixed by 8e5c84f, included in release 7.1.0: https://github.com/socketio/socket.io-redis-adapter/releases/tag/7.1.0 |
Hello, I'm still experiencing the same issue. I've tried with various Redis hosts in case that was the problem. I've also tried using both redis-node and ioredis, but it doesn't seem to work either. I've tried with TLS and without TLS. I'm a bit desperate because the error randomly restarts my Node.js server a couple of times a day. I've tried the following solutions: Catch the error with:
None of these solutions catch the error. Obviously, if I remove Redis and the adapter, it stops happening. Thank you very much for your help. My code to start the server:
With this code the server works well and all the cluster are correctly connected via redis, but randomly have the crash ´read ECONNRESET´ :( ioredis version: 5.3.2 |
I need some help as your documentation on Client Error handling seems to be gone.
I've searched through forums and issues here. I've followed the recommended actions as follows. However, I'm still not able to catch the errors below, and it's causing my app to crash. My redis servers are all well and not disconnected at that time as I have other services using same server.
Can anyone provide me with some directions?
Catching error for both sub and pub client - Done ✅
Catch error on adapter - Done ✅
Ping to keep connection alive - Done ✅
I've also tried using both node-redis and ioredis and both end up with same error below Done ✅
Manage to catch this with redis on error event ✅
Unable to catch this event ❌❌❌
I think this causes my app to crash
The text was updated successfully, but these errors were encountered: