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
On Windows, the agent process cannot daemonize when run as a subprocess of the helper client under Bazel (doing this in a shell directly with credential-helper get works fine).
I think this is a result of Bazel trying very hard to keep track of all child processes when launching a process.
On Windows, I noticed that Bazel creates a job object and sets it up so child processes cannot detach into their own job.
After a process is done, Bazel terminates whole job object, including all child processes inside of it.
So far, I haven't found a reliable way to beak out of the job group.
Ideas I have:
Try using Windows task scheduler schtasks to spawn process outside of job object using a one-off task (probably messy, may leave dangling tasks)
Variation of above, but make this a user facing feature: Have a credential-helper task-install (or similar) command that users must run on Windows in order to have the agent running for their Bazel codebase.
Have user facing command to just spawn detached agent process on Windows: credential-helper agent-daemonize. Users would need to run this before starting their Bazel server process.
As a short term workaround, make agent optional on Windows and handle death of agent process more graceful. Also consider not starting any agent process and simply trying to connect to the agent once.
To Reproduce
Use the credential helper in Bazel (via --credential_helper) on Windows.
The helper client process dies with messages like this: storing response in cache: write unix @->run\agent.sock: wsasend: An existing connection was forcibly closed by the remote host..
Using ProcMon, I was able to verify that agents are killed while in use.
Expected behavior
Multiple client processes can connect to the same agent.
After Bazel is done, the same agent process is still running in the background (test via Get-Process credential-helper).
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
malt3
changed the title
[Windows] Agent doesn't survive helper invocation
[Windows] Agent doesn't survive helper invocation when running under Bazel
Jan 4, 2025
Describe the bug
On Windows, the agent process cannot daemonize when run as a subprocess of the helper client under Bazel (doing this in a shell directly with
credential-helper get
works fine).I think this is a result of Bazel trying very hard to keep track of all child processes when launching a process.
On Windows, I noticed that Bazel creates a job object and sets it up so child processes cannot detach into their own job.
After a process is done, Bazel terminates whole job object, including all child processes inside of it.
So far, I haven't found a reliable way to beak out of the job group.
Ideas I have:
schtasks
to spawn process outside of job object using a one-off task (probably messy, may leave dangling tasks)credential-helper task-install
(or similar) command that users must run on Windows in order to have the agent running for their Bazel codebase.credential-helper agent-daemonize
. Users would need to run this before starting their Bazel server process.To Reproduce
Use the credential helper in Bazel (via
--credential_helper
) on Windows.The helper client process dies with messages like this:
storing response in cache: write unix @->run\agent.sock: wsasend: An existing connection was forcibly closed by the remote host.
.Using ProcMon, I was able to verify that agents are killed while in use.
Expected behavior
Multiple client processes can connect to the same agent.
After Bazel is done, the same agent process is still running in the background (test via
Get-Process credential-helper
).Environment
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: