Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
http: detach socket from IncomingMessage on keep-alive#32153
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
ronag commented Mar 8, 2020
@szmarczak I think this is the fix you were looking for. |
ronag commented Mar 8, 2020
I'm not sure whether setting |
7304bc7 to 4ed671fCompareszmarczak commented Mar 8, 2020
Looks amazing, you're a lifesaver! |
If the socket is not detached then a future call to res.destroy (through e.g. pipeline) would unecessarily kill the socket while its in the agent free list.
4ed671f to 30601b5Compareaddaleax commented Mar 9, 2020
nodejs-github-bot commented Mar 9, 2020
ronag commented Mar 10, 2020
CITGM looks good |
If the socket is not detached then a future call to res.destroy (through e.g. pipeline) would unecessarily kill the socket while its in the agent free list. PR-URL: #32153 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
ronag commented Mar 10, 2020
Landed in c1b2f6a |
szmarczak commented Mar 11, 2020
Since this isn't a breaking change, will this be backported? |
ronag commented Mar 11, 2020
@szmarczak it's labeled as semver-major, sorry :( |
res.socket has been detached from IncomingMessage in node-v14.x Reference: nodejs/node#32153
res.socket has been detached from IncomingMessage in node-v14.x Reference: nodejs/node#32153
res.socket has been detached from IncomingMessage in node-v14.x Reference: nodejs/node#32153
| request1.socket.destroy(); | ||
| response.socket.once('close',common.mustCall(()=>{ | ||
| request1.socket.once('close',common.mustCall(()=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's no longer testing what it used to be testing (just working around the fact that response.socket is cleared now by attaching the event to an unrelated socket?). Proper fix would be to leave the event on response.socket and just attach it before the socket is cleared (up 3 lines, right after response.pipe)?
I'm not actually familiar with this code, just in here since this test started breaking on Node v14 over in http-parser-js, which has a fork of some of these tests, but I noticed the old code also had a big comment about how important the timing/ordering of attaching that event listener was.
If the socket is not detached then a future call to res.destroy
(through e.g. pipeline) would unecessarily kill the socket while
its in the agent free list.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes