-
-
Notifications
You must be signed in to change notification settings - Fork 37.3k
cpu-prof doesn't propagate to workers when env is set #52825
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.lib / srcIssues and PRs involving general changes in the lib/ or src/ directories.Issues and PRs involving general changes in the lib/ or src/ directories.workerIssues and PRs related to the worker_threads module and Worker API.Issues and PRs related to the worker_threads module and Worker API.
Description
Activity
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.lib / srcIssues and PRs involving general changes in the lib/ or src/ directories.Issues and PRs involving general changes in the lib/ or src/ directories.workerIssues and PRs related to the worker_threads module and Worker API.Issues and PRs related to the worker_threads module and Worker API.
Version
20.8.1
Platform
Linux ushanka-housing 6.5.0-1020-oem #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 3 14:54:32 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
cpu-prof
What steps will reproduce the bug?
You can reproduce this by modifying one of the existent node tests.
If you edit
tests/fixtures/workload/fibonacci-worker.jsin this repo withand then run
the new test will fail
How often does it reproduce? Is there a required condition?
This should reproduce 100% of the time -- you don't need to do anything special
What is the expected behavior? Why is that the expected behavior?
According to https://nodejs.org/docs/latest-v20.x/api/worker_threads.html#new-workerfilename-options, the default value for a worker thread's env is process.env. Thus, not passing an environment and passing process.env as the environment should always produce the same behavior.
What do you see instead?
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