-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.
Description
- Version: 15.4.0
- Platform: Linux
- Subsystem: worker_threads
What steps will reproduce the bug?
Run the following at a bash shell:
touch empty.js
echo "new (require('worker_threads').Worker)('./empty.js')" > create-worker.js
node -r ./create-worker.js ./empty.js
How often does it reproduce? Is there a required condition?
It reproduces every time. It happens when the worker is created by a --require script.
What is the expected behavior?
No errors from the worker_thread.
What do you see instead?
Logs the following:
node:events:353
throw er; // Unhandled 'error' event
^
TypeError [Error]: undefined is not an integer typed array.
at Atomics.load (<anonymous>)
at process.cwd (node:internal/main/worker_thread:140:38)
at MessagePort.<anonymous> (node:internal/main/worker_thread:153:48)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:422:41)
at MessagePort.exports.emitMessage (node:internal/per_context/messageport:18:26)
Emitted 'error' event on process instance at:
at emitUnhandledRejectionOrErr (node:internal/event_target:602:11)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:426:9)
at MessagePort.exports.emitMessage (node:internal/per_context/messageport:18:26)
Additional information
The line number referenced in the error is here: https://github.com/nodejs/node/blob/master/lib/internal/main/worker_thread.js#L140
Based on a brief look at the code, I guess node is assuming that the worker receives a bootstrapping message with a bunch of values, one of them being cwdCounter. But when created via --require, that message is not sent or has not arrived yet.
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.workerIssues and PRs related to Worker support.Issues and PRs related to Worker support.