node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Redis connection not getting closed when pingInterval is set as part of RedissocketOptions

Open venki1092 opened this issue 2 years ago • 4 comments

Description

Hi ,

I create my RedisClient using below params

const client = createClient({ url: url, socket: { reconnectStrategy: reconnectInterval }, pingInterval: pingInterval });

When I try to close this handle using quit or disconnect it doesnt close. I see this following open handles

`tcp stream { fd: 14, readable: true, writable: true, address: {}, serverAddr: null }

tcp stream { fd: 18, readable: true, writable: true, address: {}, serverAddr: null }

tcp stream { fd: 19, readable: true, writable: true, address: {}, serverAddr: null }`

But if I remove pingInterval: pingInterval parameter during client creation handle gets closed properly on client.disconnect. Discovered this behavior while writing unit tests in Jest and had to close the handle as part of it. Please help me with this.

Node.js Version

v20.4.0

Redis Server Version

6.2.13

Node Redis Version

4.6.5

Platform

Linux

Logs

No response

venki1092 avatar Sep 06 '23 19:09 venki1092

Duplicate of #2524? try to update to the latest version, which contains this fix..

leibale avatar Sep 06 '23 21:09 leibale

Thank you. Will check this out.

venki1092 avatar Sep 06 '23 23:09 venki1092

This still seems to be an issue for me.

Node 18.17 Redis: 4.6.12

Doesn't matter if I have ping interval or not, the socket persists after a disconnect or quit. The client thinks that it's closed but the process remains running.

rizowski avatar Dec 21 '23 03:12 rizowski

This still seems to be an issue for me.

Node 18.17 Redis: 4.6.12

Doesn't matter if I have ping interval or not, the socket persists after a disconnect or quit. The client thinks that it's closed but the process remains running.

how did u fix this

Senthilmj avatar Mar 21 '24 07:03 Senthilmj