Skip to content
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

ConnectionTimeoutError #2576

Closed
DhiegoHenriqueA opened this issue Jul 21, 2023 · 4 comments
Closed

ConnectionTimeoutError #2576

DhiegoHenriqueA opened this issue Jul 21, 2023 · 4 comments
Labels

Comments

@DhiegoHenriqueA
Copy link

DhiegoHenriqueA commented Jul 21, 2023

Description

I was using version 2.8.0 of redis in an aws lambda with node in version 14.x, when updating redis version to 4.6.7 and node to version 18.x I started getting timeouts in just a few moments.

Redis Client Error ConnectionTimeoutError: Connection timeout
at Socket. (/opt/nodejs/node_modules/@redis/client/dist/lib/client/socket.js:178:124)
at Object.onceWrapper (node:events:627:28)
at Socket.emit (node:events:513:28)
at Socket._onTimeout (node:net:570:8)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)

this is my code:
const redis = require('redis')
const client = redis.createClient({
url: redis://${process.env.REDIS_IP}:${process.env.REDIS_PORT},
pingInterval: 2000,
socket: {
connectTimeout: 7000
}
})
client.connect()

client.on('error', err => console.log('Redis Client Error', err))

Node.js Version

18.17.0

Redis Server Version

6.2.6

Node Redis Version

4.6.7

Platform

No response

Logs

Redis Client Error ConnectionTimeoutError: Connection timeout
    at Socket.<anonymous> (/opt/nodejs/node_modules/@redis/client/dist/lib/client/socket.js:178:124)
    at Object.onceWrapper (node:events:627:28)
    at Socket.emit (node:events:513:28)
    at Socket._onTimeout (node:net:570:8)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
@pedrokaroth
Copy link

I have the same issue here, any update to this?

1 similar comment
@juniorSchulzDev
Copy link

I have the same issue here, any update to this?

@tchiteu
Copy link

tchiteu commented Aug 1, 2023

Same issue here...

@leibale
Copy link
Contributor

leibale commented Aug 1, 2023

Hi everyone,

Debugging a "timeout issue" can be quite challenging as it is often triggered by another underlying error. For instance, if the Redis server event loop gets blocked (which can be simulated using DEBUG SLEEP 10000 – DO NOT run this on your production server), any client attempting to open a socket will experience a timeout. Similarly, if the Node.js event loop gets blocked, timeouts will occur as well (see here for an example). Additionally, it's important to consider the possibility of an actual network issue causing the problem. Lastly, there could be an undiscovered bug in the package; however, I must mention that I personally (and many other users) run servers with the same package version and haven't experienced any timeouts.

If anyone has any insights, please feel free to share them..

Duplicate of #1656

@leibale leibale closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants