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: fix IPC 'message' event regression #13856

Merged
merged 1 commit into from
Jun 24, 2017
Merged

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Jun 21, 2017

This PR reverts 8208fda from #13459. When IPC messages are not emitted in the next tick, a 'message' handler that throws can break the IPC read loop. This was originally fixed in #6909.

The second commit in this PR adds a regression test that fails with 8208fda, but passes with the revert (at least on my machine).

Note: I believe this can be fixed without a full revert of 8208fda, but wanted to use that as a starting point for this PR.

Refs: #6909
Refs: #13459
Refs: #13648

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

child_process, test

@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label Jun 21, 2017
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also keep the benchmark in?

}
process.nextTick(() => {
target.emit(eventName, message, handle);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you restore the use of the emit() function to avoid allocating this closure?

@cjihrig
Copy link
Contributor Author

cjihrig commented Jun 22, 2017

@mcollina updated to only remove the nextTick bits.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but it might be nice to point out how much throughput we lose with this fix, with a comparative benchmark of the one the original commit introduced.

@cjihrig
Copy link
Contributor Author

cjihrig commented Jun 22, 2017

Benchmark results from my machine:

                                                                          improvement confidence      p.value
 cluster/echo.js n=100000 sendsPerBroadcast=1 payload="object" workers=1      -4.63 %        *** 5.694050e-07
 cluster/echo.js n=100000 sendsPerBroadcast=1 payload="string" workers=1     -13.46 %        *** 2.613099e-23
 cluster/echo.js n=100000 sendsPerBroadcast=10 payload="object" workers=1      1.08 %          * 2.879730e-02
 cluster/echo.js n=100000 sendsPerBroadcast=10 payload="string" workers=1     -2.41 %        *** 5.107524e-05

Looks like only a fraction of the gains from #13459 were lost.

@mcollina
Copy link
Member

Thanks Colin. Still LGTM.

@refack
Copy link
Contributor

refack commented Jun 23, 2017

Confirm test fails on my machine as well (Windows).

@cjihrig
Copy link
Contributor Author

cjihrig commented Jun 23, 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 <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
@cjihrig cjihrig merged commit 87d682b into nodejs:master Jun 24, 2017
@cjihrig cjihrig deleted the ipc branch June 24, 2017 13:05
@mscdex
Copy link
Contributor

mscdex commented Jun 24, 2017

The benchmark results from the original PR would be these since the PR was originally started before the V8 5.9 merge, so this revert has a larger impact actually. Probably the only thing that makes it have a little less of an impact is the nextTick() perf improvements that landed after the original PR landed.

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 <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
@addaleax addaleax mentioned this pull request Jun 29, 2017
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 <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
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 <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
@MylesBorins MylesBorins added the baking-for-lts PRs that need to wait before landing in a LTS release. label Aug 14, 2017
@MylesBorins
Copy link
Contributor

I've thrown a baking label on this... we should likely land if we backport other change

@MylesBorins MylesBorins removed the baking-for-lts PRs that need to wait before landing in a LTS release. label Aug 17, 2018
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants