http: destroy the socket on parse error#24757
Conversation
|
cc: @dougwilson |
Destroy the socket if the `'clientError'` event is emitted and there is no listener for it. Fixes: nodejs#24586
lib/_http_server.js
Outdated
| if (this.writable) { | ||
| this.end(badRequestResponse); | ||
| this.write(badRequestResponse); | ||
| this.destroy(e); |
There was a problem hiding this comment.
Would it make sense to wait for the write() callback to be called?
lib/_http_server.js
Outdated
| if (this.writable) { | ||
| this.end(badRequestResponse); | ||
| this.write(badRequestResponse); | ||
| this.destroy(e); |
There was a problem hiding this comment.
We should give a chance to the event loop to write this. How about we put it into a setImmediate?
There was a problem hiding this comment.
Using setImmediate() would make things even more race-y. I think it’s either using the write callback or not delaying it at all (which is still race-y, but probably more consistent?).
|
Can you please verify that http://npm.im/on-finished tests pass with this patch? |
|
Will do later today. |
|
Btw we also need #24738 as we had a regression in v11.2.0 and there are cases where |
|
|
Landed in ff7d053 |
Destroy the socket if the `'clientError'` event is emitted and there is no listener for it. Fixes: nodejs#24586 PR-URL: nodejs#24757 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
|
Ah, nice fix. |
|
This lands cleanly on 10.x. How time sensitive is it to get this out in LTS? |
|
@MylesBorins I would say as soon as possible. |
|
We talked about it at today's @nodejs/tsc meeting and we think this fix should be released asap. |
|
/cc @codebytere please pick up this commit in the 10.x release
…On Wed, Dec 5, 2018, 7:28 AM Matteo Collina ***@***.*** wrote:
We talked about it at today's @nodejs/tsc
<https://github.com/orgs/nodejs/teams/tsc> meeting and we think this fix
should be released asap.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#24757 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAecV3-rtn_4KT6_G_PWC3cWXeC0ztPvks5u17vRgaJpZM4Y8LBu>
.
|
Destroy the socket if the `'clientError'` event is emitted and there is no listener for it. Fixes: nodejs#24586 PR-URL: nodejs#24757 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Destroy the socket if the
'clientError'event is emitted and there isno listener for it.
Fixes: #24586
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes