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

Process crashes when using child_process.spawnSync(..., {stdio: ['pipe', 'overlapped', 'pipe']}) #52265

Closed
ehmicky opened this issue Mar 29, 2024 · 5 comments · May be fixed by #52352
Closed
Assignees
Labels
child_process Issues and PRs related to the child_process subsystem. confirmed-bug Issues with confirmed bugs.

Comments

@ehmicky
Copy link

ehmicky commented Mar 29, 2024

Version

v21.7.1

Platform

Linux my-laptop 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 5 21:19:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

child_process

What steps will reproduce the bug?

import {spawnSync} from 'node:child_process'

spawnSync('node', ['--version'], {stdio: ['pipe', 'overlapped', 'pipe']});
$ node example.js

  #  node[6410]: int node::SyncProcessRunner::ParseStdioOption(int, v8::Local<v8::Object>) at ../src/spawn_sync.cc:941
  #  Assertion failed: "Unreachable code reached" ": " "invalid child stdio type"

----- Native stack trace -----

 1: 0xe2fcb7 node::Assert(node::AssertionInfo const&) [node]
 2: 0xf4cc3f node::SyncProcessRunner::ParseStdioOption(int, v8::Local<v8::Object>) [node]
 3: 0xf4d8ba node::SyncProcessRunner::ParseStdioOptions(v8::Local<v8::Value>) [node]
 4: 0xf4df1b node::SyncProcessRunner::ParseOptions(v8::Local<v8::Value>) [node]
 5: 0xf4e16b node::SyncProcessRunner::TryInitializeAndRunLoop(v8::Local<v8::Value>) [node]
 6: 0xf4e538 node::SyncProcessRunner::Spawn(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 7: 0x7b7167e0eadd 

----- JavaScript stack trace -----

1: spawnSync (node:internal/child_process:1110:29)
2: spawnSync (node:child_process:876:24)
3: file:///home/me/Desktop/a.js:3:1
4: run (node:internal/modules/esm/module_job:222:25)


Aborted (core dumped)

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

I have only tried it on Linux. Since overlapped is intended for Windows, the behavior might differ there.

This only crashes with spawnSync(), not spawn().

What is the expected behavior? Why is that the expected behavior?

This should either behave like pipe, or throw an error. I am not sure which behavior would be the best there.

What do you see instead?

The process crashes.

Additional information

No response

@theanarkh
Copy link
Contributor

I think this feature is not supported in spawnSync(or execSync) currently.
See: #29412.

@targos targos added confirmed-bug Issues with confirmed bugs. child_process Issues and PRs related to the child_process subsystem. labels Mar 30, 2024
@targos
Copy link
Member

targos commented Mar 30, 2024

Then it should throw an error, not crash.

@juanarbol
Copy link
Member

Let me work on this one

@juanarbol juanarbol self-assigned this May 28, 2024
@juanarbol
Copy link
Member

Oh, never-mind, it must be fixed by #48479

So I will mark this as a dupe of #48476

@juanarbol juanarbol closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
@ehmicky
Copy link
Author

ehmicky commented May 29, 2024

Thanks for looking into this @juanarbol.

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants