Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker_threads: proper env and NODE_OPTIONS handling #31711

Closed

Conversation

lundibundi
Copy link
Member

@lundibundi lundibundi commented Feb 9, 2020

Draft for now, as I still want to review the documentation and take another look at the code.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Closes: #30627

/cc @nodejs/workers @addaleax

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Feb 9, 2020
@nodejs-github-bot
Copy link
Collaborator

@@ -1361,6 +1361,9 @@ E('ERR_WASI_ALREADY_STARTED', 'WASI instance has already started', Error);
E('ERR_WORKER_INVALID_EXEC_ARGV', (errors) =>
`Initiated Worker with invalid execArgv flags: ${errors.join(', ')}`,
Error);
E('ERR_WORKER_INVALID_NODE_OPTIONS', (errors) =>
`Initiated Worker with invalid NODE_OPTIONS: ${errors.join(', ')}`,
Error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh, I think this is a situation here we should just use ERR_WORKER_INVALID_EXEC_ARGV, as it is the same type of error that’s being reported

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave it another thought, imo ERR_WORKER_INVALID_EXEC_ARGV is way too specific and may mislead people into thinking that the error is elsewhere. I think it would be better to add ERR_WORKER_INVALID_OPTIONS and group both ERR_WORKER_INVALID_EXEC_ARGV and ERR_WORKER_INVALID_NODE_OPTIONS under it, though that may be breaking. Or just add and use ERR_WORKER_INVALID_OPTIONS here and then open a semver-major to change that in for ERR_WORKER_INVALID_EXEC_ARGV. wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a general problem with our error codes – they tend to be way too specific.

I’d be good with changing the code, but yes, that would be breaking and I’d like to avoid it in this PR.

I’d still be good with using ERR_WORKER_INVALID_EXEC_ARGV and then pointing out in the error message where the error came from (and, ideally, also in a property on the error object). We can always switch that to a different error code later.

(Fwiw, ERR_WORKER_INVALID_OPTIONS sounds like it refers to the options object passed to the Worker constructor…)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Fwiw, ERR_WORKER_INVALID_OPTIONS sounds like it refers to the options object passed to the Worker constructor…)

That was the idea - part of the options passed is incorrect. tbh we can probably use ERR_INVALID_OPT_VALUE from #31251 😄.

Then I'll use the ERR_WORKER_INVALID_EXEC_ARGV in this PR and then open another for the error change.

src/node.cc Outdated Show resolved Hide resolved
src/node_options.cc Show resolved Hide resolved
src/node_worker.cc Outdated Show resolved Hide resolved
src/node_worker.cc Show resolved Hide resolved
src/node_worker.cc Show resolved Hide resolved
@lundibundi lundibundi force-pushed the worker-proper-argv-handling branch from 8f49779 to 503003e Compare February 10, 2020 17:17
@lundibundi lundibundi marked this pull request as ready for review February 10, 2020 17:19
@nodejs-github-bot
Copy link
Collaborator

@lundibundi
Copy link
Member Author

lundibundi commented Feb 10, 2020

Not sure if flaky or a regression:
node-test-binary-arm-12+/test.sequential/test-inspector-port-zero

Error Message
fail (6)
Stacktrace
internal/console/global.js:44
globalConsole[kBindStreamsLazy](process);
                               ^

TypeError: globalConsole[kBindStreamsLazy] is not a function
    at internal/console/global.js:44:32
    at NativeModule.compileForInternalLoader (internal/bootstrap/loaders.js:276:7)
    at nativeModuleRequire (internal/bootstrap/loaders.js:305:14)
    at createGlobalConsole (internal/bootstrap/node.js:317:5)
    at internal/bootstrap/node.js:120:38

Trying a resume for now.

@nodejs-github-bot
Copy link
Collaborator

@addaleax
Copy link
Member

@lundibundi I think I’ve seen that before in another test, but really couldn’t figure out why on earth that would fail … maybe it’s worth opening an issue about that

@lundibundi lundibundi added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 10, 2020
@addaleax addaleax added the worker Issues and PRs related to Worker support. label Feb 13, 2020
@addaleax
Copy link
Member

Landed in 3e9302b...d63bcdd

@addaleax addaleax closed this Feb 13, 2020
addaleax pushed a commit that referenced this pull request Feb 13, 2020
PR-URL: #31711
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 13, 2020
PR-URL: #31711
Fixes: #30627
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@lundibundi lundibundi deleted the worker-proper-argv-handling branch February 13, 2020 18:31
codebytere pushed a commit that referenced this pull request Feb 17, 2020
PR-URL: #31711
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
codebytere pushed a commit that referenced this pull request Feb 17, 2020
PR-URL: #31711
Fixes: #30627
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@codebytere codebytere mentioned this pull request Feb 17, 2020
codebytere pushed a commit that referenced this pull request Mar 15, 2020
PR-URL: #31711
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
codebytere pushed a commit that referenced this pull request Mar 15, 2020
PR-URL: #31711
Fixes: #30627
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
PR-URL: #31711
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
PR-URL: #31711
Fixes: #30627
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@codebytere codebytere mentioned this pull request Mar 17, 2020
codebytere pushed a commit that referenced this pull request Mar 30, 2020
PR-URL: #31711
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
codebytere pushed a commit that referenced this pull request Mar 30, 2020
PR-URL: #31711
Fixes: #30627
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using execArgv with worker_threads.Worker breaks 'NODE_PRESERVE_SYMLINKS' envvar usage in worker.
4 participants