-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Conversation
@@ -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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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…)
There was a problem hiding this comment.
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.
8f49779
to
503003e
Compare
Not sure if flaky or a regression: 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. |
@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 |
Landed in 3e9302b...d63bcdd |
PR-URL: #31711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #31711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #31711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #31711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #31711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Draft for now, as I still want to review the documentation and take another look at the code.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesCloses: #30627
/cc @nodejs/workers @addaleax