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
ETIMEDOUT when nodejs is idle for awhile(even if set socket_keepalive = true) #1390
Comments
I'm also getting the same issue. |
I have found the reason. when "socket.setKeepAlive([enable][, initialDelay])" called, "initialDelay" is not set.Set initialDelay (in milliseconds) to set the delay between the last data packet received and the first keepalive probe. Setting 0 for initialDelay will leave the value unchanged from the default (or previous) setting. |
Essentially,it is affected by "tcp_keepalive_time" set. |
Any updates on this issue? We are also getting the same issue |
@orhankutlu @fanbinghuadev and @amanshu-kataria Can you give me some info on your setup? Running Redis locally? Version, etc? I can't seem to recreate. Would be easy enough to setup an option but I'm trying to determine if it should be default. |
I added "client.stream.setKeepAlive(true, 60000);" can solve this issue. @orhankutlu @stockholmux |
@fanbinghuadev That should work, but it's a band-aid solution and you'll need to do this everytime you re-connect. I'd like to get to the root of the problem - I can't personally recreate this - if you would please let me know how you're running Redis, I can fix the problem at a higher level. |
@stockholmux The root of the problem is that redis server which connected by my redis client will disconnect connection when network is idle for a hour.The machine running redis client has a tcp keepalive timeout set ,when it great than a hour,the issue maked out.So I set tcp keepalive timeout that less than a hour using nodejs api.This can make network is keepalive in a hour .Just So. |
#1396 should fix allow for this fix. You can specify a I've taken a look at the node.js net source between 8.11 and 8.12 and I see no real difference between the two as it comes to the keepAlive mechanism. Additionally, there is no rational/universal default here, so it's up to you. I suspect that the root cause is not 8.11 or 8.12 but some vendor or infrastructure provider brutally closing connections, but the initial delay should work around this issue. |
@fanbinghuadev I solved the problem by using your method: client.on('connect', function () {
var socket = client.stream
socket.setKeepAlive(true, 30 * 1000)
}) However, I found that idle redis connection will be disconnected every 2 hours, which is not 1 hour. But I'm not sure about the reason behind it. |
After connecting, client.stream is undefined. Whats the problem? |
Node.js version = v8.12.0
node_redis version = up to date
issue:
in node v8.12.0,i'm getting this error after the nodejs has had no need for redis for a couple hours.But,in node v8.11.1,i don't found issues such so.Is it seem nodejs issue?
The text was updated successfully, but these errors were encountered: