nodejs / nodejs/node

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

未关闭
#48,476 5 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

child_process
主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 child_process.execSync("ls", {stdio: "overlapped"}) 重现该问题,并检查 src/spawn_sync.cc,从 SyncProcessRunner::ParseStdioOption 和 ParseStdioOptions 开始。确认在非 Windows 系统上的行为,并确保文档所述的 stdio 处理不再触发 assertion 或导致 abort;之后再次验证重现结果。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
backend, operating-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
70/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。