child_process: ERR_INVALID_ARG_TYPE on .kill()
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
- 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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the referenced range in lib/internal/child_process.js and trace the err value from this._handle.kill(signal) through internal/errors.js, util.js, and internal/validators.js. Reproduce the .kill() failure on Windows with the reported Electron and Node versions, then determine the platform condition that produces undefined and document or test the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100