Closed MikeRalphson closed 5 years ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
lib/request.js | 2 | 11 | 18.18% | ||
<!-- | Total: | 2 | 11 | 18.18% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
lib/request.js | 2 | 79.62% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 28: | -1.5% |
Covered Lines: | 322 |
Relevant Lines: | 389 |
Thanks a lot for your collaboration,
I think that if there are pending 'streams' this change will stop these from reaching their destination as it will stop the underlying tcp connection.
Just for testing did you try to replace the original close()
to destroy()
- it should have the same results as your solution - LMK.
Will retest and let you know.
Changing the .close
to .destroy
on https://github.com/hisco/http2-client/blob/4f107432d5d671e403af559168a7c2703abed0f5/lib/request.js#L314 doesn't prevent the hanging. Maybe due to the way the socket is set up (is it prior to the http2Connection
?)
Is there a way to wait for connections on the socket to complete before destroy
ing it?
Thank you for your help.
The problem was specifically with h1.1 connections -the agent was not managing the connection due to as you said Maybe due to the way the socket is set up
.
Unfortunately, because http1 agent manages request and is not managing sockets it was a problem to fix it as I would expect.
Therefore, I've created a pull request that actually closes the http1.1 connection, caches the result, and from now on it will be a regular http request - it seems like a better solution will require some patching or re-writing core http module.
LMK if the pull request solved the issue. Thanks!
Issue was solved...
Closing this PR...
I'm seeing behaviour where programs hang once
http
orhttps
requests are replaced with this library and no other changes are made.Debugging it seems to point to
TLSSocket
s being left open, so in this PR I've added explicit tracking andend
ing of those sockets.I'd like your thoughts on this. Happy to fold the
http2Sockets
into a better structure withhttp2Clients
maybe?Bonus typo fixed too.