child_process: ERR_INVALID_ARG_TYPE on .kill()
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.3k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 283
描述
- Version: Electron v4.2.12 - Node v10.11.0
- Platform: Windows 10 64-bit
- Subsystem: child_process
We are getting the following stack trace when killing a child_process:
root ERROR TypeError [ERR_INVALID_ARG_TYPE]: The "err" argument must be of type number. Received type undefined
at validateNumber (internal/validators.js:130:11)
at Object.getSystemErrorName (util.js:1435:3)
at errnoException (internal/errors.js:303:21)
at ChildProcess.kill (internal/child_process.js:430:26)
From what I can make of it, it seems to be caused by the following code:
https://github.com/nodejs/node/blob/v10.x/lib/internal/child_process.js#L425-L439
var err = this._handle.kill(signal);
if (err === 0) {
/* Success. */
this.killed = true;
return true;
}
if (err === UV_ESRCH) {
/* Already dead. */
} else if (err === UV_EINVAL || err === UV_ENOSYS) {
/* The underlying platform doesn't support this signal. */
throw errnoException(err, 'kill');
} else {
/* Other error, almost certainly EPERM. */
this.emit('error', errnoException(err, 'kill'));
}
Somehow, err seems to be undefined, making us land in the last else branch, but then errnoException doesn't know what to make out of it and throws the error that we see.
The issue only happens in Electron, so it might not be entirely related to Node, but I was wondering if this err value is expected to be undefined in some circumstance?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 lib/internal/child_process.js 中被引用的范围开始,跟踪 err 值从 this._handle.kill(signal) 经过 internal/errors.js、util.js 和 internal/validators.js 的流程。在报告的 Electron 和 Node 版本下于 Windows 上复现 .kill() 失败,然后确定会产生 undefined 的平台条件,并记录或测试预期行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 需要澄清
- 新手友好度
- 42/100