Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-05-18 09:55:17 +0300
committerJames M Snell <jasnell@gmail.com>2020-05-22 03:50:04 +0300
commitc45313b3ad47d7e7aa7d204d3ac002a5bbdf3bcb (patch)
treee1459fbbd15dc42eeefe41f21ef8d3e99d4d9e1c /lib/internal/main
parentb6b82cba27da9ef83bfef67cac9d3593bd72c0e2 (diff)
worker: perform initial port.unref() before preload modules
The refcount of the internal communication port is relevant for stdio, but the `port.unref()` call effectively resets any `.ref()` calls happening during stdio operations happening before it. Therefore, do the `.unref()` call before loading preload modules, which may cause stdio operations. Fixes: https://github.com/nodejs/node/issues/31777 PR-URL: https://github.com/nodejs/node/pull/33455 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Diffstat (limited to 'lib/internal/main')
-rw-r--r--lib/internal/main/worker_thread.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index ecf5d00c440..6e3935d1382 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -92,6 +92,7 @@ if (process.env.NODE_CHANNEL_FD) {
port.on('message', (message) => {
if (message.type === LOAD_SCRIPT) {
+ port.unref();
const {
argv,
cwdCounter,
@@ -145,7 +146,6 @@ port.on('message', (message) => {
debug(`[${threadId}] starts worker script ${filename} ` +
`(eval = ${eval}) at cwd = ${process.cwd()}`);
- port.unref();
port.postMessage({ type: UP_AND_RUNNING });
if (doEval) {
const { evalScript } = require('internal/process/execution');