You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what you think keepAlive and keepAliveMsecs do but they enable TCP (not HTTP) keep-alive on your side. It's completely transparent to the remote end (the IIS server). Most HTTP servers will disconnect after a period of inactivity, hence the ECONNRESET.
Maybe I should have said: keepAlive in conjunction with keepAliveMsecs. The latter sets the TCP keep-alive interval, the former tells node to reuse the socket when it can. The point is though that regardless of using TCP or HTTP keep-alive on your end, the remote end can still elect to close the connection.
If you think the documentation is unclear, can you file an issue for that and suggest improvements or send a pull request?
Because ECONNRESET is an exceptional error, it means the remote end forcibly closed the connection. If the agent swallowed the error you couldn't distinguish an empty reply from unclean termination, for example.
For whoever is picking this up, it's probably worth mentioning that the naive solution of attaching an error listener in the agent's 'free' event listener introduces a race window in lib/_http_client.js between the removal of the socket's 'error' event listener in responseOnEnd() and returning it to the pool in emitFreeNT().
changed the title [-]http.request: keep-alive leads to unhandled ECONNRESET[/-][+]http.Agent: idle sockets throw unhandled ECONNRESET[/+]on Oct 30, 2015
I am facing the same issue in signalr which uses long polling and my program stops in 2 mins. This was working fine before node.js upgrade from 0.12.6 to 4.1.2
I think it will be nice if the Http Agent had a socket event for every socket created. If I understand correctly the issue, the server can close the connection at any time, being the socket free or not.
It looks like I'm seeing the same problem on 0.12.10, does that make sense? I didn't see this on 0.10.41 but it showed up when I upgraded to 0.12.
From reading this thread my understanding is that the underlying issue is that socket connections with HTTP keep-alive are being closed by the remote host but the error handler isn't being cleaned up. Is that right?
@thorn0 I'm not sure if it is a bug, therefore I am asking whether there is a known issue about such cases? Because we setup everything in our info such ulimit etc. But it happens every 15 seconds periodic on different API calls
@nodesocket v0.12 is in maintenance mode now, meaning that it gets security fixes but not much more. Though if you or someone else is willing to work on the backport, we'll certainly review it.
I've got also ECONNRESET error. But it is really weird.
It was working well. After a week, one of my client asked some update, and it doesn't work suddenly.
I didn't change the project~
It was calling google place api using axios, also I tried node-fetch as well.
Both of them give above error.
What's the issue?
Is this because of Node?
Reacted by Alexandru Căncescu, Pavel Bihel and Weihong Xu
Activity
bnoordhuis commentedon Oct 30, 2015
Reproducing your code here for the sake of posterity:
I'm not sure what you think
keepAliveandkeepAliveMsecsdo but they enable TCP (not HTTP) keep-alive on your side. It's completely transparent to the remote end (the IIS server). Most HTTP servers will disconnect after a period of inactivity, hence the ECONNRESET.I don't see a bug here. I'll close the issue.
thorn0 commentedon Oct 30, 2015
I'm really confused. https://nodejs.org/api/http.html states the opposite:
bnoordhuis commentedon Oct 30, 2015
Maybe I should have said:
keepAlivein conjunction withkeepAliveMsecs. The latter sets the TCP keep-alive interval, the former tells node to reuse the socket when it can. The point is though that regardless of using TCP or HTTP keep-alive on your end, the remote end can still elect to close the connection.If you think the documentation is unclear, can you file an issue for that and suggest improvements or send a pull request?
thorn0 commentedon Oct 30, 2015
I still can't get it.
http.Agentencapsulates all the other parts of the socket pool management logic. Why doesn't it catch this ECONNRESET at that?bnoordhuis commentedon Oct 30, 2015
Because ECONNRESET is an exceptional error, it means the remote end forcibly closed the connection. If the agent swallowed the error you couldn't distinguish an empty reply from unclean termination, for example.
thorn0 commentedon Oct 30, 2015
An empty reply to what? The discussed exception happens when the socket is waiting in the pool and isn't used for a request.
bnoordhuis commentedon Oct 30, 2015
With all due respect, that's not very clear from your original message. I'll reopen the issue, pull requests welcome.
bnoordhuis commentedon Oct 30, 2015
For whoever is picking this up, it's probably worth mentioning that the naive solution of attaching an error listener in the agent's
'free'event listener introduces a race window inlib/_http_client.jsbetween the removal of the socket's'error'event listener inresponseOnEnd()and returning it to the pool inemitFreeNT().[-]http.request: keep-alive leads to unhandled ECONNRESET[/-][+]http.Agent: idle sockets throw unhandled ECONNRESET[/+]livesankp commentedon Oct 30, 2015
Hello,
I am facing the same issue in signalr which uses long polling and my program stops in 2 mins. This was working fine before node.js upgrade from 0.12.6 to 4.1.2
jfromaniello commentedon Dec 22, 2015
I think it will be nice if the Http Agent had a
socketevent for every socket created. If I understand correctly the issue, the server can close the connection at any time, being the socket free or not.thorn0 commentedon Dec 22, 2015
No, this issue is only about free (idle) sockets.
20 remaining items
http: handle errors on idle sockets
http: handle errors on idle sockets
drewfish commentedon Mar 10, 2016
It looks like I'm seeing the same problem on 0.12.10, does that make sense? I didn't see this on 0.10.41 but it showed up when I upgraded to 0.12.
From reading this thread my understanding is that the underlying issue is that socket connections with HTTP keep-alive are being closed by the remote host but the error handler isn't being cleaned up. Is that right?
drewfish commentedon Mar 14, 2016
@mikemorris looks like this fix shipped with 4.4.0 (and 5.4.0).
aymeba commentedon Mar 14, 2016
Hi,
we are also getting an ECONNRESET error. I'm not sure if this is the same bug?
Version: 4.2.2
thorn0 commentedon Mar 14, 2016
@aymeba No. This issue is only about idle sockets in the pool. It's not about sockets assigned to requests (your case)..
aymeba commentedon Mar 14, 2016
@thorn0 thanks. Is there a known issue about requests?
thorn0 commentedon Mar 14, 2016
@aymeba Why do you think it's a bug in Node?
aymeba commentedon Mar 14, 2016
@thorn0 I'm not sure if it is a bug, therefore I am asking whether there is a known issue about such cases? Because we setup everything in our info such ulimit etc. But it happens every 15 seconds periodic on different API calls
thorn0 commentedon Mar 14, 2016
@aymeba I don't know about such known issues.
ECONNRESETis a normal error if you have network troubles.lukasz-zak commentedon Mar 16, 2016
Thank you @thealphanerd and whole Node team for release this fix in 4.x branch.
http: handle errors on idle sockets
nodesocket commentedon May 4, 2016
Is this going to be ported into the
0.12.Xbuild by chance? I think we are being bitten by this with npm. See the following issue npm/registry#10.bnoordhuis commentedon May 6, 2016
@nodesocket v0.12 is in maintenance mode now, meaning that it gets security fixes but not much more. Though if you or someone else is willing to work on the backport, we'll certainly review it.
definoob commentedon Dec 19, 2019
I've got also ECONNRESET error. But it is really weird.
It was working well. After a week, one of my client asked some update, and it doesn't work suddenly.
I didn't change the project~
It was calling google place api using axios, also I tried node-fetch as well.
Both of them give above error.
What's the issue?
Is this because of Node?