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.spawnSync may results an abort #38070

Closed
zyscoder opened this issue Apr 4, 2021 · 3 comments
Closed

child_process.spawnSync may results an abort #38070

zyscoder opened this issue Apr 4, 2021 · 3 comments
Labels
child_process Issues and PRs related to the child_process subsystem. confirmed-bug Issues with confirmed bugs. tty Issues and PRs related to the tty subsystem.

Comments

@zyscoder
Copy link

zyscoder commented Apr 4, 2021

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

new tty.ReadStream(4);
child_process.spawnSync('str');

Then the node instance occurs an abort.
In my practice, the only value "4" results in the abort.

How often does it reproduce? Is there a required condition?

This abort can always be triggered following the steps above.

What is the expected behavior?

I noticed that nodejs docs say "In normal circumstances process.stdin will be the only tty.ReadStream instance in a Node.js process and there should be no reason to create additional instances.". Maybe some limitation for users to construct a tty.ReadStream is needed. If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.

What do you see instead?

» node
Welcome to Node.js v14.15.1.
Type ".help" for more information.
> new tty.ReadStream(4);
<ref *1> ReadStream {
 ...
}
> child_process.spawnSync('str');
[2]    2461977 abort      node                                                                                                                                                                                      

Additional information

@aduh95 aduh95 added child_process Issues and PRs related to the child_process subsystem. confirmed-bug Issues with confirmed bugs. tty Issues and PRs related to the tty subsystem. labels Apr 4, 2021
@aduh95 aduh95 changed the title "process.spawnSync" may results an abort child_process.spawnSync may results an abort Apr 4, 2021
@Ayase-252
Copy link
Member

Refs: #37780 #38021

Is using these constructors of both tty.ReadStream or tty.createStream illegal in userland?

@addaleax
Copy link
Member

addaleax commented Apr 7, 2021

This is basically of the same kind as #37874, you’re interfering with an fd owned by libuv and see a crash as a consequence of that, not really surprising and not really something that you should do in any case.

Is using these constructors of both tty.ReadStream or tty.createStream illegal in userland?

No.

@yashLadha
Copy link
Contributor

@addaleax If there is no AI can we close this issue.

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. confirmed-bug Issues with confirmed bugs. tty Issues and PRs related to the tty subsystem.
Projects
None yet
Development

No branches or pull requests

5 participants