Uh oh!
There was an error while loading. Please reload this page.
tty: implement ReadStream._final to avoid ENOTCONN on .end() - #22900
tty: implement ReadStream._final to avoid ENOTCONN on .end()#22900mcollina wants to merge 1 commit into
Conversation
addaleax
commented
Sep 17, 2018
Is this also a change that came with the libuv TTY changes? My gut feeling would be that ignoring |
mcollina
commented
Sep 17, 2018
Yes.
I think it's still valid for |
addaleax
commented
Sep 17, 2018
I know why it’s being emitted… I guess my main issue with this approach is that it adds more special handling for different types of streams, when we’ve been putting some effort into reducing exactly that. Conceptually, the Alternatively, would it make sense to skip the |
mcollina
commented
Sep 17, 2018
I'll do that instead. It's more consistent. |
mcollina
commented
Sep 17, 2018
I'm not super confident about this change. Specifically because |
addaleax
left a comment
There was a problem hiding this comment.
Thanks!
Specifically because
process.stdin.write()would likely emit anENOTCONNas well. I think we should error in that case.
I agree, silently swallowing input data is a different thing.
mcollina
commented
Sep 17, 2018
I'll see what |
Fishrock123
commented
Sep 17, 2018
CI seems to fail? I'm not sure about the exact specifics but it sounds reasonable. |
mcollina
commented
Sep 17, 2018
Let's try CI: https://ci.nodejs.org/job/node-test-pull-request/17251/ |
mcollina
commented
Sep 17, 2018
@addaleax handling it within |
| // otherwise, just shutdown, or destroy() if not possible | ||
| if (!this._handle || !this._handle.shutdown) { | ||
| if (!this[kShouldShutdown] || !this._handle || !this._handle.shutdown) { |
There was a problem hiding this comment.
I think the issue might be that this runs destroy() when it previously didn’t.
I can try it too (later), but maybe undoing this line change and adding if (!this[kShouldShutdown]) return cb(); below works?
There was a problem hiding this comment.
It doesn't because the writable: false parameter that is passed in to the net.Socket constructor does control other behaviors internally, and it does not mean "this is half-open".
If you want to give it a shot, feel free to push here. Otherwise we revert to the _final solution.
| } | ||
| inherits(ReadStream, net.Socket); | ||
| options.writable = options.writable || false; | ||
| const { allowHalfOpen } = options; | ||
| // Needed to avoid to call uv_shutdown during _final |
addaleax
commented
Sep 19, 2018
I think libuv/libuv@4049879 may have fixed this as well, by making things work again on the libuv side? |
mcollina
commented
Sep 19, 2018
I think so. Have you tested it? |
addaleax
commented
Sep 19, 2018
@mcollina Just checked, and yes, it does fix |
Would prefer to wait for libuv patch (should be soon enough?)
mcollina
commented
Sep 19, 2018
Let's wait for that. |
addaleax
commented
Sep 24, 2018
I’ve opened a PR with only the test changes here (and attribution to you), so I hope it’s okay to close this. You know what to do if I’m mistaken :) |
Fixes: #22814.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes