Closed
Description
- Version: v12.21.0
- Platform: Linux 5.8.0-38-generic The binary and long term compatibility with node #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: worker_threads.terminate
What steps will reproduce the bug?
Setup a node instance,
» node
and run the following javascript code.
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