fix: use close event on response instead of socket#1892
fix: use close event on response instead of socket#1892josephharrington merged 1 commit intomasterfrom
Conversation
In #1880, we switched from using the close event on `req` to close on `req.socket`. This addressed the intended issue but can trigger frequent warnings when keep-alive is used due to a listener being added for each request on the same socket. By using the close event on `res` instead, we address both the issue of event ordering in Node.js >= 16 that the original change was targeting and the event emitter warning leak.
|
Am I missing something here? IIUC a client stopping in the middle of a EDIT: I wonder if keeping both the socket and res close events would work? |
I believe I validated that the
Then we'd still have the event emitter leak warning, yes? |
mmarchini
left a comment
There was a problem hiding this comment.
this should be fine and unless someone can come up with a scenario where this would leak memory/resources we should merge it (since it's better than the current state of things)
|
Please release it in npm too. |
In #1880, we switched from using the close event on
reqto close onreq.socket. This addressed the intended issue but can trigger frequentwarnings when keep-alive is used due to a listener being added for each
request on the same socket.
By using the close event on
resinstead, we address both the issue ofevent ordering in Node.js >= 16 that the original change was targeting
and the event emitter warning leak.
Fixes #1883.