Skip to content

SocketClosedUnexpectedlyError - Unhandled ErrorΒ #2624

Open
@elvince

Description

@elvince

Description

Hi,

We are experiencing issue with the client. Many times a day we have this unhandled error that is thrown away from the redis client.

We have properly set the "Error" handler but it is not catched in it. As a consequence our process is crashing multiple times per day.
It is severly impacting our customers.

We already dig into the issue list where this error was mentionned, we tried the PingInterval / SetInterval stuff as we are on Azure but it doesn't fix the issue.

I suspect this is another edge case than the load balancer that drop the connection.
If you can see how to catch properly this error so the reconnect system can reopen smoothlty the connection it will save our day.

Thanks,

Node.js Version

Node.js v18.17.1

Redis Server Version

Node.js v18.17.1

Node Redis Version

No response

Platform

Linux

Logs

2023-10-04T09:34:16.491974249Z node:events:492
2023-10-04T09:34:16.492029849Z       throw er; // Unhandled 'error' event
2023-10-04T09:34:16.492037249Z       ^
2023-10-04T09:34:16.492041649Z 
2023-10-04T09:34:16.492045549Z SocketClosedUnexpectedlyError: Socket closed unexpectedly
2023-10-04T09:34:16.492049849Z     at Socket.<anonymous> (/home/site/wwwroot/node_modules/@redis/client/dist/lib/client/socket.js:194:118)
2023-10-04T09:34:16.492054649Z     at Object.onceWrapper (node:events:629:26)
2023-10-04T09:34:16.492058649Z     at Socket.emit (node:events:514:28)
2023-10-04T09:34:16.492062649Z     at TCP.<anonymous> (node:net:323:12)
2023-10-04T09:34:16.492066948Z Emitted 'error' event on Commander instance at:
2023-10-04T09:34:16.492071048Z     at RedisSocket.<anonymous> (/home/site/wwwroot/node_modules/@redis/client/dist/lib/client/index.js:396:14)
2023-10-04T09:34:16.492075148Z     at RedisSocket.emit (node:events:514:28)
2023-10-04T09:34:16.492082148Z     at RedisSocket._RedisSocket_onSocketError (/home/site/wwwroot/node_modules/@redis/client/dist/lib/client/socket.js:217:10)
2023-10-04T09:34:16.492086248Z     at Socket.<anonymous> (/home/site/wwwroot/node_modules/@redis/client/dist/lib/client/socket.js:194:107)
2023-10-04T09:34:16.492090248Z     at Object.onceWrapper (node:events:629:26)
2023-10-04T09:34:16.492094048Z     at Socket.emit (node:events:514:28)
2023-10-04T09:34:16.492097948Z     at TCP.<anonymous> (node:net:323:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions