-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
[v12.x] http: fix crash for sync write errors during header parsing #34251
Conversation
Fix a crash that occurs when `parser.finish()` is called during `parser.execute()`. In this particular case, this happened because a 100 continue response is a place in which `.end()` can be called which can in turn lead to a write error, which is emitted synchronously, thus inside the outer `parser.execute()` call. Resolve that by delaying the `parser.finish()` call until after the `parser.execute()` call is done. This only affects v12.x, because on later versions, errors are not emitted synchronously. Fixes: nodejs#15102
Since the tests only crash on v12.x, this commit adds separate regression tests. Refs: nodejs#15102
@nodejs/http Can anybody review this? Only the first commit needs reviews, the remainder is just a backport of #34250 |
b64963e
to
3b1d9b3
Compare
ping @nodejs/http |
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.
LGTM
Can I ask what is left in the process to get this merged into 12.x, or if there is anything we can do to help? |
be41c83
to
efb5192
Compare
@lsr0 I don’t think there’s anything missing here, I’ll try to make sure it goes into the next release. |
efb5192
to
26f2d97
Compare
26f2d97
to
55fe022
Compare
55fe022
to
65b7bf4
Compare
Landed in 65b7bf4...867c451 |
Fix a crash that occurs when `parser.finish()` is called during `parser.execute()`. In this particular case, this happened because a 100 continue response is a place in which `.end()` can be called which can in turn lead to a write error, which is emitted synchronously, thus inside the outer `parser.execute()` call. Resolve that by delaying the `parser.finish()` call until after the `parser.execute()` call is done. This only affects v12.x, because on later versions, errors are not emitted synchronously. PR-URL: #34251 Fixes: #15102 Fixes: #34016 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
Since the tests only crash on v12.x, this commit adds separate regression tests. PR-URL: #34251 Refs: #15102 Refs: #34016 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
http: fix crash for sync write errors during header parsing
Fix a crash that occurs when
parser.finish()
is called duringparser.execute()
. In this particular case, this happened becausea 100 continue response is a place in which
.end()
can be calledwhich can in turn lead to a write error, which is emitted
synchronously, thus inside the outer
parser.execute()
call.Resolve that by delaying the
parser.finish()
call until afterthe
parser.execute()
call is done.This only affects v12.x, because on later versions, errors are not
emitted synchronously.
Fixes: #15102
Fixes: #34016
test: add regression tests for HTTP parser crash
Since the tests only crash on v12.x, this commit adds separate
regression tests.
Refs: #15102
Refs: #34016
[This is #34250, which this PR is blocked on.]
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes