mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
worker: set stack size for worker threads
This is so we can inform V8 about a known limit for the stack. Otherwise, on some systems recursive functions may lead to segmentation faults rather than “safe” failures. PR-URL: https://github.com/nodejs/node/pull/26049 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
da0dc51e39
commit
a80b29b38a
3 changed files with 29 additions and 1 deletions
11
test/parallel/test-worker-stack-overflow.js
Normal file
11
test/parallel/test-worker-stack-overflow.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const { Worker } = require('worker_threads');
|
||||
|
||||
const worker = new Worker('function f() { f(); } f();', { eval: true });
|
||||
|
||||
worker.on('error', common.mustCall((err) => {
|
||||
assert.strictEqual(err.constructor, RangeError);
|
||||
assert.strictEqual(err.message, 'Maximum call stack size exceeded');
|
||||
}));
|
Loading…
Add table
Add a link
Reference in a new issue