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
When using an http agent with keepAlive: true and not completely draining the request response,
the process sometimes terminates immediately and sometimes keeps waiting until the connection gets closed.
In the code above, when URL gets replaced with http://google.com,
the process will remain running for several minutes and then terminate.
The same occurs with URL http://fragments.dbpedia.org/en
When doing the same with http://www.google.be (which is what google.com redirects me to,
so will probably provide different results for everyone) the process terminates immediately,
most of the time. Sometimes the result is the same as in the first scenario.
URL http://fragments.dbpedia.org/2016-04/en provides the same result
A third scenario is with http://httpstat.us/200, where after a few minutes the process
terminates with a ECONNRESET error.
In all 3 scenarios the 'response' string gets printed immediately.
Since this might be a timing issue those URLs might not return the same results depending on who runs it.
When checking with wireshark, in the first scenario the communication gets terminated
with a FIN message sent by the server.
In the second scenario a RST message gets sent by the client to the server,
and in the third scenario a RST message gets sent by the server to the client.
Now, scenario 1 and 3 I understand since the connection is still running so the agent keeps the socket open.
But why does the socket immediately get closed by the client in scenario 2?
Is this expected behaviour or is this a timing issue?
The text was updated successfully, but these errors were encountered:
@joachimvh I realize this is super late but I'm pretty sure this is because it responds with transfer-encoding: chunked, right? I don't think those connections are reusable.
When using an http agent with
keepAlive: true
and not completely draining the request response,the process sometimes terminates immediately and sometimes keeps waiting until the connection gets closed.
In the code above, when URL gets replaced with
http://google.com
,the process will remain running for several minutes and then terminate.
The same occurs with URL
http://fragments.dbpedia.org/en
When doing the same with
http://www.google.be
(which is what google.com redirects me to,so will probably provide different results for everyone) the process terminates immediately,
most of the time. Sometimes the result is the same as in the first scenario.
URL
http://fragments.dbpedia.org/2016-04/en
provides the same resultA third scenario is with
http://httpstat.us/200
, where after a few minutes the processterminates with a ECONNRESET error.
In all 3 scenarios the 'response' string gets printed immediately.
Since this might be a timing issue those URLs might not return the same results depending on who runs it.
When checking with wireshark, in the first scenario the communication gets terminated
with a FIN message sent by the server.
In the second scenario a RST message gets sent by the client to the server,
and in the third scenario a RST message gets sent by the server to the client.
Now, scenario 1 and 3 I understand since the connection is still running so the agent keeps the socket open.
But why does the socket immediately get closed by the client in scenario 2?
Is this expected behaviour or is this a timing issue?
The text was updated successfully, but these errors were encountered: