Skip to content
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

child_process: remove nextTick on IPC message #13648

Closed

Conversation

mscdex
Copy link
Contributor

@mscdex mscdex commented Jun 13, 2017

This is a follow up to #13459 which avoided all but the first nextTick() on receipt of non-internal IPC messages. The reason for that was I just wanted to be more cautious in that PR. This PR however removes nextTick() entirely as messages should always be received on future tick(s) anyway, so there shouldn't be any issues with user event handlers being executed immediately after calling fork(), etc.

Benchmark results:

                                                                           improvement confidence      p.value
 cluster/echo.js n=100000 sendsPerBroadcast=1 payload="object" workers=1       0.26 %            8.604902e-01
 cluster/echo.js n=100000 sendsPerBroadcast=1 payload="string" workers=1      -1.01 %            5.727488e-01
 cluster/echo.js n=100000 sendsPerBroadcast=10 payload="object" workers=1      2.68 %          * 4.315368e-02
 cluster/echo.js n=100000 sendsPerBroadcast=10 payload="string" workers=1      6.08 %        *** 1.943506e-09

CI: https://ci.nodejs.org/job/node-test-pull-request/8621/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

@mscdex mscdex added child_process Issues and PRs related to the child_process subsystem. performance Issues and PRs related to the performance of Node.js. labels Jun 13, 2017
@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label Jun 13, 2017
@mscdex mscdex force-pushed the child_process-no-nexttick-on-ipc-message branch from 213a261 to def344b Compare June 13, 2017 05:15
@bnoordhuis
Copy link
Member

The problem I see is that an exception in a user's 'message' listener throws a wrench in the channel.onread loop, it will lose any subsequent messages.

@mscdex
Copy link
Contributor Author

mscdex commented Jun 13, 2017

@bnoordhuis Wouldn't that be the case in general, no matter if each message was nextTick()ed?

cjihrig added a commit to cjihrig/node that referenced this pull request Jun 24, 2017
This commit fixes a regression related to IPC 'message'
events. When messages are not emitted in the next tick,
a 'message' handler that throws can break the IPC read
loop.

Refs: nodejs#6909
Refs: nodejs#13459
Refs: nodejs#13648
PR-URL: nodejs#13856
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
addaleax pushed a commit that referenced this pull request Jun 29, 2017
This commit fixes a regression related to IPC 'message'
events. When messages are not emitted in the next tick,
a 'message' handler that throws can break the IPC read
loop.

Refs: #6909
Refs: #13459
Refs: #13648
PR-URL: #13856
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
@mscdex mscdex closed this Jul 5, 2017
@mscdex mscdex deleted the child_process-no-nexttick-on-ipc-message branch July 5, 2017 06:00
addaleax pushed a commit that referenced this pull request Jul 11, 2017
This commit fixes a regression related to IPC 'message'
events. When messages are not emitted in the next tick,
a 'message' handler that throws can break the IPC read
loop.

Refs: #6909
Refs: #13459
Refs: #13648
PR-URL: #13856
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
addaleax pushed a commit that referenced this pull request Jul 18, 2017
This commit fixes a regression related to IPC 'message'
events. When messages are not emitted in the next tick,
a 'message' handler that throws can break the IPC read
loop.

Refs: #6909
Refs: #13459
Refs: #13648
PR-URL: #13856
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. performance Issues and PRs related to the performance of Node.js.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants