-
Notifications
You must be signed in to change notification settings - Fork 30k
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
src: unconsume stream fix #11015
src: unconsume stream fix #11015
Conversation
91c2f70
to
bc8ea9d
Compare
R= @indutny probably? |
I think we'd rather want to handle it from JS. We should mark stream as previously consumed and fallback to slow Does this make sense? |
@indutny - Thanks for your response. |
@Kasher this C++ API needs some serious renovation and this is a separate question, in my opinion. I suggested to do it in JS, because this bug will still manifest itself if anyone would try to |
@indutny - Cool. I got it. How should I implement your suggestion? Should I keep the same parser for the socket in _http_server.js, and never free\unconsume it (which means some changes in the function onParserExecuteCommon in _http_server.js)? Thanks a lot!! |
@Kasher there is a fallback mode there when it checks for Lines 331 to 335 in a67a04d
This won't affect context of callbacks as the attached http parser (if any) will still be alive until |
@indutny Thanks again for your help. My 'connect' handler is being called from the function Line 466 in a67a04d
A few lines before my handler is called, there is a call to Line 453 in a67a04d
Hence, when my connect handler is called, there is no http-parser attached to the socket. If I remove the call to consume as you suggested, no parser will be attached at all, and no callbacks will be set to the socket's _externalStream .Do you suggest to remove the call to unconsume as well, so the parser will still be attached? This will result in a refactor in the onParserExecuteCommon method, since I guess we shouldn't execute the following lines as well:Lines 450 to 456 in a67a04d
Did I miss something? Thanks a lot, your help is really appreciated!!! |
bc8ea9d
to
e3fec99
Compare
@kosher |
e3fec99
to
cd3f670
Compare
@indutny Thanks again. |
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.
Few style nits, otherwise looks good!
lib/_http_server.js
Outdated
parser._consumed = true; | ||
parser.consume(external); | ||
// We only consume the socket if it has never been consumed before. | ||
if (!socket._handle._consumed) { |
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.
Minor style nit:
var external = socket._handle._externalStream;
if (!socket._handle._consumed && external) {
...
}
Less indent - awesome 😉
cd3f670
to
1701267
Compare
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket).
bd2e905
to
00a6340
Compare
Looks like it's ready for a CI: https://ci.nodejs.org/job/node-test-pull-request/6103/ |
The linux tester failed for fedora24 - 32bit on the test So, just to verify - is this by any chance a known issue? If it isn't - I'll download the appropriate iso and create a VM to test this. Thanks. |
Yeah it's a known issue(#11041), also the arm failure is actually not a failure, it's related to some infra issue so it's actually green in the webpage. I'll say CI is green for this PR. |
@joyeecheung Awesome, thanks! |
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: #11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 3e3bfc5 |
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: #11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: nodejs#11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: nodejs#11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: #11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: #11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: #11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
When emitting a 'connection' event on a httpServer, the function connectionListener is called. Then, a new parser is created, and 'consume' method is called on the socket's externalStream. However, if this stream was already consumed and unconsumed, the process crashes with a cpp assert from the 'Consume' method in stream_base.h. This commit makes sure that no SIGABRT will be raised and the process will stay alive (after emitting the socket). PR-URL: #11015 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Node 7 does not include nodejs/node#11015. Without this fix, the process is killed when proxying a connection through HTTPS. We could try to work around this on our end, but node 7 is officially unsupported, and it seems more sensible to simply drop support here entirely too.
When emitting a
connection
event on a httpServer, the functionconnectionListener
is called.Then, a new parser is created, and
consume
method is called on thesocket's
externalStream
. However, if this stream was already consumed and unconsumed,the process crashes with a cpp assert from the
Consume
method instream_base.h
. This commit makes sure that no SIGABRT will be raisedand the process will stay alive (after emitting the socket).
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src
Issue: #11017