-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
child_process: fix channel disconnect logic #19566
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
Conversation
0943fd3
to
49c68b9
Compare
So running the new test against the old code I realized closing the handle when an error is reported is actually inconsistent with the previous behavior. Also in the queue there aren't actually handles, but the server/socket/etc. objects as passed by the user. Oops. I'll update the PR to fix that in second. |
c596738
to
fff9957
Compare
@nodejs/child_process @addaleax @bnoordhuis PTAL |
Ping @nodejs/collaborators @nodejs/tsc this needs some people who worked on |
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.
Can't really comment on the change itself, sorry.
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.
Left some comments but apart from that LGTM.
lib/internal/child_process.js
Outdated
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.
Can you move this into the if
block? Callbacks and event listeners should get fresh exception objects so they don't step on each other when they modify it.
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.
Slightly nicer to set socket.setEncoding('utf8')
once.
@laino Do you want to look into the requested changes? |
ping @laino |
ping @laino |
fff9957
to
74ceb62
Compare
Implemented the requested changes and rebased onto the current master. |
Cannot comment a change, unfortunately (I'm not really familiar with child_process) though @laino could you rebase this once again and I'll then start a CI for this one? |
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.
Nit: I don't think additional parentheses are needed here.
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.
assert.ifError(
?
ping @laino |
- Fix close not being emitted when calling process.disconnect() from a parent process. - Extend child-process-disconnect test case to also check that 'close' was emitted after 'exit' after 'disconnect'. - Create child-process-close-handle-queue test case, checking that 'send' callbacks of pending handles are called. Fixes: nodejs#19433
74ceb62
to
40a840d
Compare
Closing this due to inactivity. Please reopen if needed. |
from a parent process.
was emitted after 'exit' after 'disconnect'.
that 'send' callbacks of pending handles are called.
Fixes: #19433
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes