nodejs / nodejs/node

Unreachable code reached when using {stdio: "overlapped"}

Open
#48,476 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

child_process
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

18.16.0

Platform

Linux fedora 6.3.5-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 30 15:44:17 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?
child_process.execSync("ls", {stdio: "overlapped"})
How often does it reproduce? Is there a required condition?

Always

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

Execute the subprocess, and return some object.
According to the documentation, pipe should be used on non-Windows systems.

What do you see instead?

A segfault.

node[107754]: ../../src/spawn_sync.cc:934:int node::SyncProcessRunner::ParseStdioOption(int, v8::Local<v8::Object>): Assertion `"Unreachable code reached" ": " "invalid child stdio type"' failed.
 1: 0x7ff7073fde1c node::Abort() [/lib64/libnode.so.108]
 2: 0x7ff7073fdeab  [/lib64/libnode.so.108]
 3: 0x7ff7074dbbe9 node::SyncProcessRunner::ParseStdioOption(int, v8::Local<v8::Object>) [/lib64/libnode.so.108]
 4: 0x7ff7074dbeda node::SyncProcessRunner::ParseStdioOptions(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 5: 0x7ff7074dcc5d node::SyncProcessRunner::ParseOptions(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 6: 0x7ff7074dce53 node::SyncProcessRunner::TryInitializeAndRunLoop(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 7: 0x7ff7074dd008 node::SyncProcessRunner::Run(v8::Local<v8::Value>) [/lib64/libnode.so.108]
 8: 0x7ff7074dd127 node::SyncProcessRunner::Spawn(v8::FunctionCallbackInfo<v8::Value> const&) [/lib64/libnode.so.108]
 9: 0x7ff7086c60f6 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/lib64/libnode.so.108]
10: 0x7ff7086c66b1  [/lib64/libnode.so.108]
11: 0x7ff7086c6fad v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/lib64/libnode.so.108]
12: 0x7ff708559539  [/lib64/libnode.so.108]
Aborted (core dumped)
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with child_process.execSync("ls", {stdio: "overlapped"}) and inspect src/spawn_sync.cc, starting at SyncProcessRunner::ParseStdioOption and ParseStdioOptions. Confirm the behavior on non-Windows systems and make sure the documented stdio handling no longer reaches the assertion or aborts; verify the reproduction afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.