| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Once again, nice work!
Sorry, something went wrong.
|
@oyyd Actually … do you know why there are a write request and a shutdown request simultaneously in that code? In net.js, shutdownSocket() is only triggered in _final(); and I thought that always happened after all writes are finished… is that wrong? |
Sorry, something went wrong.
|
@addaleax this.finishWrite() and this.finishShutdown() inside of doClose() are likely to be no-ops. But in theory, there are some places doing handle.close() outside of _final(), such as this one: Line 1236 in 6223236 As handle.close() trigger doClose() and some of them are outside of _final(), it looks possible that this.finishWrite() and this.finishShutdown() would take effect. But, again, handle.close() outside of _final() never get called when wrapping net.Socket in StreamWrap. We don't use StreamWrap for server sockets and StreamWrap is even not a public API in our docs. At least, I tried hard but failed to create a possible scenario and removing them didn't break any tests on my Mac. Maybe some of our old code used them somehow, but IDK. The usage of StreamWrap in http2 is similar. If you are suggesting removing them, I would agree with that. |
Sorry, something went wrong.
|
@oyyd As you say, the line you’re pointing to is for server sockets, so I don’t think that’s an issue… The thing is, generally there should only be 1 ShutdownWrap or 1 WriteWrap be active for a certain stream, ever… it’s okay that doClose() can be called at any time, but if I understand correctly, this PR fixes the situation when there is a ShutdownWrap and a WriteWrap? And I’m wondering why that situation occurrs in the first place… |
Sorry, something went wrong.
I agree.
I'm not totally sure but I guess it doesn't, or my intention is different. My original intention is that I noticed that some stream won't emit drain(or they emit earlier than we bind to drain) so that we won't call this.stream.end() correctly: node/lib/internal/wrap_js_stream.js Lines 118 to 119 in 6223236 But it works well because when a ReadableStream ends, they call end() on WritableStream, except that this.allowHalfOpen is true. And calling end() later than expected might cause other issues. For those writing operations don't emit drain, I try to call kDoShutdown after WriteReq so that the streams will end correctly. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Test failed: parallel/test-https-host-headers logtest https server listening on port 41235 Error: 4395995780336:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:../deps/openssl/openssl/ssl/record/ssl3_record.c:469: |
Sorry, something went wrong.
|
parallel/test-https-host-headers seems to be flaky as it could also fail before this commit and the error logs are just like other flaky tls tests (like: #23913) |
Sorry, something went wrong.
|
@addaleax Oops, I guess I was taking Node 10.x as my "control group" by mistake.. But I still have some doubt about the reason. Let me dig into this a bit. |
Sorry, something went wrong.
Yes. Therefore I prefer not to modify the code if we couldn't find clear goodness it could bring. But I think it's fine to keep the test for #23654. I have modified the title and description of this PR. BTW, another place that is confusing to me is that if we don't call tlsSocket.end(), i.e. comment this line: Then the sockets won't hang anymore on Node 10.13.0. This needs more investigation but we could discuss it elsewhere. |
Sorry, something went wrong.
This test ensures that a tls client socket using `StreamWrap` with `allowHalfOpen` option won't hang.
Sorry, something went wrong.
There was a problem hiding this comment.
Still very much LGTM :)
Sorry, something went wrong.
Partially revert b7e6ccd because it broke a test that was added since its last CI run. Refs: nodejs#24075 Refs: nodejs#23866
Partially revert b7e6ccd because it broke a test that was added since its last CI run. Refs: nodejs#24075 Refs: nodejs#23866 PR-URL: nodejs#24288 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
| Back | FazBrowse Home | New Git URL |
A tls client socket using StreamWrap with allowHalfOpen option might hang instead of exiting automatically because the 'drain' event may not be emitted. This commit corrects it by making StreamWrap try doShutdown in finishWrite.
Before this commit, running the following test will make processes hang.
This test ensures that a tls client socket using StreamWrap with allowHalfOpen option won't hang.
Refs: #23654
Checklist