Windows runner intermittently fails job with prepare environment: exit status 0xc0000142 error
Status update: 2024-04-09
As of today unable to reproduce. I asked support to check with customer. I will close issue on 2024-04-12 if no response or customer validated that issue is no longer occuring
Summary
The pipeline jobs are failing intermittently every few days with the following error in the job logs:
ERROR: Job failed: prepare environment: exit status 0xc0000142. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
When the runner is re-registered, it works fine for a week or a two, but after that the jobs fail with the same error intermittently.
The job logs (debug enabled) and runner logs don't have any details on why the job failed.
There are multiple nodes where the runners are hosted, and the same issue can be noticed across all the nodes.
Steps to reproduce
- The customer can reproduce the issue by running the job multiple times with a sample .gitlab-ci.yml template.
- The support team couldn't reproduce the issue
.gitlab-ci.yml
- The customer can reproduce the issue with any CI file, for example this.
Actual behavior
- All the jobs should've completed succefully
Expected behavior
- The jobs fail with the following error intermittently:
ERROR: Job failed: prepare environment: exit status 0xc0000142. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Relevant logs and/or screenshots
job log
Running with gitlab-runner 15.8.1 (f86890c6)
2 on ca2-S1 11, system ID: s_xyz
3Resolving secrets00:00
5Preparing the "shell" executor00:00
6Using Shell executor...
8Preparing environment00:00
10ERROR: Job failed: prepare environment: exit status 0xc0000142. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Environment description
- They are using Windows server 2019
- PowerShell is on version 5.1.17
- Runner version : 15.10.1
- GitLab instance version : 15.10.x
config.toml contents
[[runners]]
name = "ca2sgitla002p-S4"
output_limit = 10000
url = "https://gitlab.example.com/"
token = "[MASKED]"
executor = "shell"
shell = "powershell"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
Used GitLab Runner version
Possible fixes
- Current workaround is to periodically re-register the runner with GitLab instance, with this the runner works fine for a week or two. But this is not a long term solution.
Proposal
-
Placeholder for proposal.