Skip to content

EphemeralRunners created just before a controller restart never get a status or pod, and hold maxRunners until something updates them #4751

Open

Description

@rolandovalenzuela-ei

Checks

  • I've already read the troubleshooting guide
  • I am using charts that are officially provided

Controller Version

0.15.1

Deployment Method

Helm (gha-runner-scale-set-controller and gha-runner-scale-set charts 0.15.1, installed by Flux)

Checks

  • This isn't a question or user support case
  • 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

  1. Run the controller with several runner scale sets on EKS 1.36. The affected scale set had maxRunners: 50 and minRunners: 0.
  2. While jobs are queued and the controller is creating EphemeralRunners for them, restart the controller: kubectl rollout restart deployment/<controller>.
  3. Look at the EphemeralRunners created in the minute or two before the restart.

It happened once in production use. A second deliberate restart two days later, with fewer jobs in flight, did not reproduce it, so it looks like a race around the restart.

Describe the bug

  • About 2 to 3 minutes before the restart, the old controller pod scaled the affected set from 9 to 50 pending EphemeralRunners for queued jobs.
  • The old pod got SIGTERM while it was still reconciling them. Its in-flight reconciles failed with context canceled (fetching the JIT secret, creating the pod, deleting a pod) for 29 EphemeralRunners in that set, all within the same 2 ms at shutdown. No reconcile error was retried later.
  • After the new pod started, 59 EphemeralRunners across 7 scale sets had no status at all: no phase and no runner pod. For at least one of them the JIT config and secret had been created two seconds before shutdown, and only the pod create was cancelled.
  • 16 of them, in six scale sets, cleared on their own within a few minutes.
  • 43, all in one scale set, stayed like that for about 90 minutes. The new controller never reconciled them: it logged nothing for those EphemeralRunner names, and its own counts for the set stayed at 47 to 49 pending, 0 to 1 running, from 19:24 to 20:00. Because they count toward maxRunners (50), that scale set could not create new runners, and its jobs stayed queued.
  • Adding any annotation to a stuck EphemeralRunner (kubectl annotate ephemeralrunner <name> foo=bar) made the controller reconcile it at once: it created the JIT secret and pod, and the runner went on normally. That's how we recovered.

Describe the expected behavior

After a restart the controller reconciles every existing EphemeralRunner, including ones created by the previous pod that have no status yet, and either finishes creating them or deletes and replaces them. A runner without a status should not hold a maxRunners slot indefinitely.

Additional Context

  • As a workaround we run a CronJob every 5 minutes that annotates EphemeralRunners that have had no status for 5 minutes, once each. Since then, no runner has stayed without a status for more than about a minute.
  • We did not capture the stuck objects' full YAML during the incident. On a recurrence we will add kubectl get ephemeralrunner <name> -o yaml for one of them.

Controller Logs

# old controller pod (<old>), one stuck EphemeralRunner
19:24:02.017 INFO  Creating ephemeral runner JIT config                       ephemeralrunner=<runner-a>
19:24:02.017 INFO  Created ephemeral runner JIT config                        ephemeralrunner=<runner-a>
19:24:02.017 INFO  Created ephemeral runner secret                            ephemeralrunner=<runner-a>
19:24:02.017 INFO  Ephemeral runner pod does not exist. Creating new ephemeral runner  ephemeralrunner=<runner-a>
19:24:02.017 INFO  Created new pod spec for ephemeral runner                  ephemeralrunner=<runner-a>
19:24:04.018 INFO  Stopping and waiting for non leader election runnables
19:24:04.018 INFO  Stopping and waiting for leader election runnables
19:24:04.018 ERROR Failed to create pod resource for ephemeral runner.  error="Post \"https://172.20.0.1:443/api/v1/namespaces/<ns>/pods\": context canceled"  ephemeralrunner=<runner-a>
19:24:04.018 ERROR Failed to create the pod                               error="... context canceled"  ephemeralrunner=<runner-a>
19:24:04.018 ERROR Failed to fetch secret                                 error="context canceled"      ephemeralrunner=<runner-b>
19:24:04.020 INFO  Wait completed, proceeding to shutdown the manager

# errors from the old pod at shutdown, all 19:24:04.018-.020
Failed to fetch secret: context canceled                       x32
Failed to create the pod: context canceled                     x4
Failed to clean up ephemeral runner owned resources: failed to delete pod: context canceled  x3
(each followed by "Reconciler error")

# new controller pod (<new>), started 19:24:06.789
19:24:06 INFO  Ephemeral runner counts  ephemeralrunnerset=<set> pending=50 running=0 finished=0 failed=0
19:30:02 INFO  Ephemeral runner counts  ephemeralrunnerset=<set> pending=47 running=1
19:45:06 INFO  Ephemeral runner counts  ephemeralrunnerset=<set> pending=49 running=0
19:58:04 INFO  Ephemeral runner counts  ephemeralrunnerset=<set> pending=49 running=0
# no log line from the new pod mentions <runner-a> or <runner-b> between 19:24 and 20:00

Runner Pod Logs

No runner pods were created for the stuck EphemeralRunners, so there are no pod logs.

Activity

  1. github-actions commented on Nov 20, 2026

    @github-actions
    Contributor

    Hello! Thank you for filing an issue.

    The maintainers will triage your issue shortly.

    In the meantime, please take a look at the troubleshooting guide for bug reports.

    If this is a feature request, please review our contribution guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions