actions-runner-controller: EphemeralRunners are stuck in failed state after the job succeeds
Checks
- I’ve already read https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/troubleshooting-actions-runner-controller-errors and I’m sure my issue is not covered in the troubleshooting guide.
- I am using charts that are officially provided
Controller Version
0.12.0
Deployment Method
ArgoCD
Checks
- This isn’t a question or user support case (For Q&A and community support, go to Discussions).
- I’ve read the Changelog before submitting this issue and I’m sure it’s not due to any recently-introduced backward-incompatible changes
To Reproduce
Not consistently reproducible, there's a small chance for it to happen whenever a job succeeds.
Just run some workload, then check that no EphemeralRunners are stuck in a failed state.
Describe the bug
After the workload succeeds the controller marks the EphemeralRunner as failed and it doesn’t create a new pod, just hangs in a failed state until manually removed. There is always exactly 1 failure with a timestamp: "status": { "failures": {"<uuid>": "<timestamp>"}}.
It probably lingers in the Github API a bit longer after the pod dies and the controller treats it as a failure. It calls deletePodAsFailed which is what’s visible in the log excerpt.
After that it goes into backoff but it is never processed again. After the backoff period elapses there are no further logs available referencing the EphemeralRunner and it remains stuck and unmanaged.
For now we are removing these orphans periodically but the orphans seem to negatively impact CI job startup times.
The runners are eventually removed from Github API because I manually checked them and they were no longer present in Github. Yet the EphemeralRunners remain stuck.
Describe the expected behavior
The EphemeralRunner is cleanly removed once Github releases it. It should keep reconciling after the backoff period elapses instead of giving up on it silently.
Additional Context
Using a simple runnerset with DinD mode, cloud Github organization installation (via Github app).
Controller Logs
https://gist.github.com/Dawnflash/0a3fc1da0f99dfe67fc17b6987821a53
Runner Pod Logs
Don't have those but the jobs normally succeed. All green in Github.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 24
- Comments: 26 (2 by maintainers)
Hey everyone, I just wanted to let you all know that we identified the problem.
The check to see if the runner exists within the service can sometimes return a false positive result. Even though this will be fixed on the back-end, the PR #4142 should also resolve the issue, since we don’t need this check.
As long as the runner image is properly built (i.e. the entrypoint will return the exit code of the runner), the check we are doing right now is not necessary. Therefore, we will remove it.
Hey everyone, we decided to publish a new release today! The
0.12.1is out! 😄Hey everyone, just to let you all know, we are targeting Monday for the next patch release that will include this fix.
I can corroborate this issue, was going to open it myself but didn’t get a chance to yet. The EphemeralRunners exist indefinitely with a
.status.phase: Running. I’ll share the cronjob setup I added to buy me time to continue investigating without blocking our users’ job startups:zombie-runner-cleanup.yaml
(obviously change the namespace as needed for your env)
This issue was not happening to our runners in 0.11.0. And it is not intermittent, in the sense that the overall issue doesn’t come and go by the day, it is always affecting some percentage of our runners, but it IS intermittent in the sense that it seems to happen randomly to our jobs, with no discernible difference. It seems to affect roughly 2-20 jobs an hour for us. If we don’t clean them up, the controller seems to be counting those as part of the current scale metric so it doesn’t think it needs more runners added to meet demand, thus the increasing length of job queue.
We are running into the same issue after upgrading to
0.12.0. In the previous version, there would beFailedephemeral runners that wouldn’t get cleaned up but at least it was clear what the resolution should be or what to monitor.With the new release, it even takes that away. The stats for
autoscalingrunnersetsget to an invalid state and we only managed to figure out based on the age of theephemeralrunners. Therunnerpods do not exist.Hey @shivansh-ptr,
That is exactly the root of the problem. After the workflow is done, we check if the runner exists. Since it does (in this case), we mark the ephemeral runner as failed, which creates this entry in
Failures. It would then start the crash loop (since at that point, the runner registration is invalid), and would cause the ephemeral runner to reach the failed state.Thanks for the script, this appears to be working for us.
@nikola-jokic I don’t know if there are others on 0.11.0 still who are experiencing this same issue, but I doubt it, based on the fact that immediately after upgrading ours from 0.11.0 to 0.12.0 this issue started. The disappointing part is we eagerly upgraded because of https://github.com/actions/actions-runner-controller/issues/3685, only to get hit with this arguably worse bug.
@shivansh-ptr that sounds like a separate type of problem and belongs in a separate issue
@nimjor we upgraded from 0.9.3 also because of that bug, now i don’t know which one i prefer lol i can confirm that with your script we didn’t have issues this morning, let’s see thanks!