Skip to content

worker: perform initial port.unref() before preload modules - #33455

Closed
addaleax wants to merge 1 commit into
nodejs:masterfrom
addaleax:worker-port-unref-early
Closed

worker: perform initial port.unref() before preload modules#33455
addaleax wants to merge 1 commit into
nodejs:masterfrom
addaleax:worker-port-unref-early

Conversation

@addaleax

Copy link
Copy Markdown
Member

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: #31777

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
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: nodejs#31777
@addaleax addaleax added the worker Issues and PRs related to the worker_threads module and Worker API. label May 18, 2020
@addaleax addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label May 19, 2020
jasnell pushed a commit that referenced this pull request May 22, 2020
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: #31777

PR-URL: #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>
@jasnell

jasnell commented May 22, 2020

Copy link
Copy Markdown
Member

Landed in c45313b

@jasnell jasnell closed this May 22, 2020
codebytere pushed a commit that referenced this pull request Jun 18, 2020
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: #31777

PR-URL: #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>
@codebytere codebytere mentioned this pull request Jun 28, 2020
codebytere pushed a commit that referenced this pull request Jul 8, 2020
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: #31777

PR-URL: #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>
@codebytere codebytere mentioned this pull request Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. worker Issues and PRs related to the worker_threads module and Worker API.

6 participants