-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: fix node watchdog race condition
PR-URL: #43780 Fixes: #43699 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
// This test ensures that running vm with breakOnSignt option in multiple | ||
// worker_threads does not crash. | ||
// Issue: https://github.com/nodejs/node/issues/43699 | ||
const { Worker } = require('worker_threads'); | ||
const vm = require('vm'); | ||
|
||
// Don't use isMainThread to allow running this test inside a worker. | ||
if (!process.env.HAS_STARTED_WORKER) { | ||
process.env.HAS_STARTED_WORKER = 1; | ||
for (let i = 0; i < 10; i++) { | ||
const worker = new Worker(__filename); | ||
worker.on('exit', common.mustCall()); | ||
} | ||
} else { | ||
const ctx = vm.createContext({}); | ||
for (let i = 0; i < 10000; i++) { | ||
vm.runInContext('console.log(1)', ctx, { breakOnSigint: true }); | ||
} | ||
} |