You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cpu-prof doesn't propagate to workers when env is set #52825
When running in its original form, the test produces two profile files, as intended. When passing {env: process.env} into the worker invocation, however, it only produces one profile file.
Additional information
If I print the environment in the worker thread, it appears to be identical in both cases. It doesn't seem like the problem is that part of the environment is getting lost, but rather there's some hidden variable that isn't getting propagated
(I determined this by fiddling around with the /lib/internal/worker.js file, and seeing that no matter the value set, the issue has to do with the WorkerImpl, implemented in CPP)
Activity
avivkeller commentedon May 4, 2024
I've been able to reproduce.
node --cpu-prof index.jsavivkeller commentedon May 4, 2024
The issue occurs when the
envis set to any value. I'll look into it.avivkeller commentedon May 4, 2024
I've determined the issue is not on the JS side of things but on the C++ side instead. I'm no CPP expert, so I haven't looked into it much, but I'd assume it is has something to do with the
node_worker.ccfile: https://github.com/nodejs/node/blob/71a1fa3043d495dfaa2105d07cd090c51bcd8eed/src/node_worker.cc(I determined this by fiddling around with the
/lib/internal/worker.jsfile, and seeing that no matter the value set, the issue has to do with theWorkerImpl, implemented in CPP)avivkeller commentedon May 4, 2024
CC @nodejs/workers
theanarkh commentedon May 4, 2024
I think the relevant code is here . I debug into the C++ code and found the
cpu_profinenv->options_isfalse.src: make sure pass the `argv` to worker threads
src: make sure pass the `argv` to worker threads
src: make sure pass the `argv` to worker threads
src: make sure pass the `argv` to worker threads