forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: handling v8 thread pool of zero
fix: nodejs#42523 Problem: If no platform worker exists, Node.js doesn't shut down when background tasks exist. It keeps waiting in `NodePlatform::DrainTasks`. Observation: It seems that Node.js used to use V8's `DefaultPlatform` implementation, which chooses a suitable default value in case that `--v8-pool-size=0` is given as a command-line option. However, Node.js currently uses its own v8::Platform implementation, `NodePlatform`. It doesn't have the logic to handle the case. I referred to nodejs#4344 to track the issue.
- Loading branch information
Showing
3 changed files
with
31 additions
and
3 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,15 @@ | ||
// Flags: --v8-pool-size=0 | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const { Worker, isMainThread } = require('worker_threads'); | ||
|
||
if (isMainThread) { | ||
const w = new Worker(__filename); | ||
w.on('online', common.mustCall()); | ||
w.on('exit', common.mustCall((code) => assert.strictEqual(code, 0))); | ||
process.on('exit', (code) => { | ||
assert.strictEqual(code, 0); | ||
}); | ||
} |