You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
worker_threads.terminate results in no response on v12.x #38208
worker_threads = require('worker_threads');newWorker = new worker_threads.Worker('str',{eval:true,resourceLimits:{maxYoungGenerationSizeMb:0,maxOldGenerationSizeMb:0}});
arr = [];
for (let i = 0; i < 15000000; i ++) {
arr.push("num." + i);
}
newWorker.terminate();
Then the node instance stuck and has no response even with "Ctl-D".
How often does it reproduce? Is there a required condition?
This can be triggered following the steps above almost every time. If not, try again, please.
What is the expected behavior?
As the docs said, Stop all JavaScript execution in the worker thread as soon as possible. Returns a Promise for the exit code that is fulfilled when the 'exit' event is emitted..
What do you see instead?
» node
Welcome to Node.js v12.21.0.
Type ".help" for more information.
> worker_threads = require('worker_threads');newWorker = new worker_threads.Worker('str',{eval:true,resourceLimits:{maxYoungGenerationSizeMb:0,maxOldGenerationSizeMb:0}});
Worker {
...
}
> arr = [];
[]
> for (let i = 0; i < 15000000; i ++) {
... arr.push("num." + i);
... }
15000000
> newWorker.terminate();
^C^C^C^C
Activity
Trott commentedon Apr 12, 2021
On macOS, the test code aborts the process in Node.js 12.x but works as expected in Node.js 14.x and 15.x.
@nodejs/workers
worker: avoid potential deadlock on NearHeapLimit
worker: avoid potential deadlock on NearHeapLimit
worker: avoid potential deadlock on NearHeapLimit
worker: avoid potential deadlock on NearHeapLimit
worker: avoid potential deadlock on NearHeapLimit
worker: avoid potential deadlock on NearHeapLimit