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: fork() from -e does not exit #3574

Closed
bnoordhuis opened this issue Oct 28, 2015 · 2 comments · May be fixed by B020239/node#1
Closed

child_process: fork() from -e does not exit #3574

bnoordhuis opened this issue Oct 28, 2015 · 2 comments · May be fixed by B020239/node#1
Labels
child_process Issues and PRs related to the child_process subsystem.

Comments

@bnoordhuis
Copy link
Member

From here:

$ out/Release/node -e \
    'require("child_process").fork("test/fixtures/empty.js").on("exit", console.log)'
# doesn't print, doesn't exit

parallel/test-child-process-fork3 does the same thing from a file and works fine. Dropping the 'exit' listener doesn't make a difference. @Trott points out that this goes back to at least v0.8.28.

@bnoordhuis bnoordhuis added the child_process Issues and PRs related to the child_process subsystem. label Oct 28, 2015
@bnoordhuis
Copy link
Member Author

It's a fork bomb!

$ strace -qs 256 -fe execve out/Release/node -e 'require("child_process").fork("test/fixtures/empty.js")'
execve("out/Release/node", ["out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")"], [/* 41 vars */]) = 0
[pid  5436] execve("/home/bnoordhuis/src/v1.x/out/Release/node", ["/home/bnoordhuis/src/v1.x/out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")", "test/fixtures/empty.js"], [/* 42 vars */]) = 0
[pid  5441] execve("/home/bnoordhuis/src/v1.x/out/Release/node", ["/home/bnoordhuis/src/v1.x/out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")", "test/fixtures/empty.js"], [/* 42 vars */]) = 0
[pid  5446] execve("/home/bnoordhuis/src/v1.x/out/Release/node", ["/home/bnoordhuis/src/v1.x/out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")", "test/fixtures/empty.js"], [/* 42 vars */]) = 0
[pid  5451] execve("/home/bnoordhuis/src/v1.x/out/Release/node", ["/home/bnoordhuis/src/v1.x/out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")", "test/fixtures/empty.js"], [/* 42 vars */]) = 0
[pid  5456] execve("/home/bnoordhuis/src/v1.x/out/Release/node", ["/home/bnoordhuis/src/v1.x/out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")", "test/fixtures/empty.js"], [/* 42 vars */]) = 0
[pid  5461] execve("/home/bnoordhuis/src/v1.x/out/Release/node", ["/home/bnoordhuis/src/v1.x/out/Release/node", "-e", "require(\"child_process\").fork(\"test/fixtures/empty.js\")", "test/fixtures/empty.js"], [/* 42 vars */]) = 0
# etc.

@Trott
Copy link
Member

Trott commented Oct 29, 2015

Confirmed on Node 0.6.21-pre too.. It's possible that there's never been a release with a version of child_process.fork() that didn't have this issue!

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Oct 29, 2015
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: nodejs#3574
PR-URL: nodejs#3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
bnoordhuis added a commit that referenced this issue Nov 7, 2015
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: #3574
PR-URL: #3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
bnoordhuis added a commit that referenced this issue Nov 30, 2015
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: #3574
PR-URL: #3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
bnoordhuis added a commit that referenced this issue Dec 4, 2015
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: #3574
PR-URL: #3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
bnoordhuis added a commit that referenced this issue Dec 17, 2015
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: #3574
PR-URL: #3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
bnoordhuis added a commit that referenced this issue Dec 23, 2015
Remove the `-e` argument from process.execArgv in child_process.fork()
to keep `node -e 'require("child_process").fork("empty.js")'` from
spawning itself recursively.

Fixes: #3574
PR-URL: #3575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants