-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Using execArgv with worker_threads.Worker breaks 'NODE_PRESERVE_SYMLINKS' envvar usage in worker. #30627
Comments
@arciisine, I was able to recreate it with flag const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
const a = true
if (isMainThread) {
new Worker(__filename, { execArgv:[a]});
}
else {
console.log('Inside Worker!');
const k = new Buffer(10)
} I debugged in worker threads and based on my observation, the property is set at lib/internal/bootstrap/pre_execution.js but later it is unset, do not know for whatever reason. |
|
Also, is there a way for me to print debug data in the bootstrap phase? |
@HarshithaKP The reason that this is happening is that when
For debugging Node.js core, |
@addaleax , thanks for the info on
I believe this is a bug, do you agree?
I am trying to find out that location, but failed. I looked at these locations:
Do you know where this decision is taken? my current debugging is halted with this finding: Line 7 in f895b5a
It returns |
Yes.
The |
PR-URL: #31711 Fixes: #30627 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #31711 Fixes: #30627 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #31711 Fixes: #30627 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #31711 Fixes: #30627 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
I have a
child_process.fork
that I am converting to use theworker_threads
module. Currently I need to conditionally preserve symlinks, and this information was being passed through environment variables to the forked process. Switching over toworker_threads
, this seemed to no longer work by default.When creating the
Worker
instance, I am passing theNODE_PRESERVE_SYMLINKS
flag in theenv
object. This fails to to work whenexecArgv
is used as well. By removingexecArgv
, everything works as expected.Looking at the docs for
Worker
'sexecArgv
I can pass the
--preserve-symlinks
flag as a CLI option, and I've verified that is working. Though this is less than ideal as I need to enforce this conditionally.Ultimately I'm trying to see if there is something overriding the
env
usage, or if theenv
vars, regarding process creation are potentially being ignored.The text was updated successfully, but these errors were encountered: