Skip to content

Runner cancelled while job is still running #3298

Closed

Description

@jwilkicki

Checks

Controller Version

0.8.2

Deployment Method

Helm

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

  1. Setup ARC system per quickstart:
NAMESPACE="arc-systems"
helm install arc \
    --namespace "${NAMESPACE}" \
    --create-namespace \
    oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller

kubectl create configmap -n "${NAMESPACE}" self-signed-cert --from-file=self.crt=/usr/local/share/ca-certificates/self.crt
kubectl rollout restart -n "${NAMESPACE}" deployment arc-gha-rs-controller
  1. Then installed a runner set with this configuration:
githubConfigUrl: https://github.mycompany.com/development/my_repo

template:
  spec:
    initContainers:
      - name: init-dind-externals
        image: docker.repositories.mycompany.com/my-custom-runner:latest
        command:
          ["cp", "-r", "-v", "/home/runner/externals/.", "/home/runner/tmpDir/"]
        volumeMounts:
          - name: dind-externals
            mountPath: /home/runner/tmpDir
    containers:
      - name: runner
        image: docker.repositories.mycompany.com/my-custom-runner:latest
        command: ["/home/runner/run.sh"]
        env:
          - name: DOCKER_HOST
            value: unix:///run/docker/docker.sock
        volumeMounts:
          - name: work
            mountPath: /home/runner/_work
          - name: dind-sock
            mountPath: /run/docker
            readOnly: true
      - name: dind
        image: docker.repositories.mycompany.com/docker:dind
        args:
          - dockerd
          - --host=unix:///run/docker/docker.sock
          - --group=$(DOCKER_GROUP_GID)
        env:
          - name: DOCKER_GROUP_GID
            value: "123"
        securityContext:
          privileged: true
        volumeMounts:
          - name: work
            mountPath: /home/runner/_work
          - name: dind-sock
            mountPath: /run/docker
          - name: dind-externals
            mountPath: /home/runner/externals
    volumes:
      - name: work
        emptyDir: {}
      - name: dind-sock
        emptyDir: {}
      - name: dind-externals
        emptyDir: {}

githubServerTLS:
  certificateFrom:
    configMapKeyRef:
      name: self-signed-cert
      key: self.crt
  runnerMountPath: /usr/local/share/ca-certificates/

And this command:

INSTALLATION_NAME="myrepo-runner-set"
NAMESPACE="arc-runners"
GITHUB_PAT="XXXXXX"

helm upgrade "${INSTALLATION_NAME}" \
    --install \
    --namespace "${NAMESPACE}" \
    --create-namespace \
    --set githubConfigSecret.github_token="${GITHUB_PAT}" \
    -f runners_values.yaml \
    oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set

kubectl create configmap -n "${NAMESPACE}" selfcert --from-file=self.crt=/usr/local/share/ca-certificates/self.crt

I created a custom docker image to add my self-signed cert and a bunch tools:

FROM ghcr.io/actions/actions-runner:latest

USER root

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
  && apt-get install -y software-properties-common \
  && add-apt-repository -y ppa:git-core/ppa \
  && apt-get update -y \
  && apt-get install -y --no-install-recommends \
  curl \
  ca-certificates \
  git \
  iproute2 \
  iptables \
  jq \
  sudo \
  uidmap \
  unzip \
  zip \
  fuse-overlayfs \
  gpg \
  lsb-release \
  apt-transport-https \
  openssh-client

# Download latest git-lfs version
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
  apt-get install -y --no-install-recommends git-lfs

COPY self.crt /usr/local/share/ca-certificates
RUN update-ca-certificates


# Install Terraform
ENV TERRAFORM_VERSION="1.3.7"
ENV VAULT_VERSION="1.15.4"
RUN curl -Lo hashicorp.gpg https://apt.releases.hashicorp.com/gpg && \
  apt-key add hashicorp.gpg && \
  rm hashicorp.gpg && \
  echo "deb https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list && \
  apt-get -y update && \
  apt-get -y install terraform${TERRAFORM_VERSION:+=}${TERRAFORM_VERSION}  && \
  rm -v /etc/apt/sources.list.d/hashicorp.list && \
  terraform version 
  
RUN curl -Lo vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip && \
  unzip vault.zip && \
  chmod +x vault && \
  mv vault /usr/local/bin/ && \
  vault version    


# Clean APT cache - put all apt installs before here
RUN rm -rf /var/lib/apt/lists/*

# Install kubectl
ENV KUBECTL_VERSION="v1.26.0"
RUN curl -L -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" &&\
  chmod 755 /usr/local/bin/kubectl && \
  kubectl version --client=true --short

# Install helm
ENV HELM_VERSION="3.13.3"
RUN curl -L -o helm.tar.gz "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" &&\
  tar zxvf helm.tar.gz linux-amd64/helm &&\
  mv linux-amd64/helm /usr/local/bin &&\
  rmdir linux-amd64 &&\
  chmod 755 /usr/local/bin/helm &&\
  rm helm.tar.gz && \
  helm version

# Install awscli v2
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
  unzip awscliv2.zip && \
  ./aws/install && \
  rm -rfv aws awscliv2.zip && \
  aws --version

ENV TERRAGRUNT_VERSION="v0.55.4"
ADD https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 /tmp
RUN mv /tmp/terragrunt_linux_amd64 /usr/local/bin/terragrunt && \
  chmod +x /usr/local/bin/terragrunt && \
  terragrunt --version

USER runner

Describe the bug

The runner starts running the job and while running a go test command shows: Error: Process completed with exit code 130.

Annotations on the job are:

test / test
The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
test / test
The operation was canceled.
test / test
Process completed with exit code 130.

The job should run to completion. Output from the go test command seemed to indicate that tests were passing and there weren't any error messages.

Describe the expected behavior

The job should run to completion, even if go test fails

Additional Context

See steps to reproduce

Controller Logs

https://gist.github.com/jwilkicki/b1b3ec5ae2cad23285f4c40d18070daf

Runner Pod Logs

https://gist.github.com/jwilkicki/5a63aa79d2347605e1caa54e1b2e7fc6

Activity

  1. added
    bug
    gha-runner-scale-set
    needs triage
    on Feb 21, 2024
  2. github-actions commented on Feb 21, 2024

    @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.

  3. nikola-jokic commented on Feb 22, 2024

    @nikola-jokic
    Collaborator

    Hey @jwilkicki,

    This issue is not related to ARC, since the runner pod started and picked up the job successfully. Because of that, I am going to close this issue. However, to solve your problem, you should probably try to see if memory usage on the node kills the runner pod. Please try setting requests/limits and see if the issue occurs

  4. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    I have metrics server installed and was watching k top nodes and I didn't see any resource exhaustion. It looks like something thinks the job can be cancelled because it became unregistered even though it is still running.

  5. nikola-jokic commented on Feb 22, 2024

    @nikola-jokic
    Collaborator

    The runner log only shows the symlinks. Based on the log, it seems like the runner doesn't even have a chance to start. Can you please check if the runner starts and maybe update the log so I can look into it? I still feel like this is not ARC issue, but I can provide some pointers that may help you resolve it ☺️

  6. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    I would definitely welcome some pointers. As far as I can tell, the pod is running. My job looks normal in the Github Actions UI and my job is not failing at the very first steps; it process a bunch of them until it gets to my actual unit tests.
    I'm re-running my job right now while running watch kubectl top nodes. I'll keep watching resource usage through to failure to see if I'm exhausting anything. Then I'll see if I can get some clearer logs.

  7. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    So, I watched the node usage and the logs. CPU usage on my node got to 103% but memory seemed to peak around 60-ish%. The pod still seemed to be running and then it got a "user cancelled" message and started winding down. See this gist: https://gist.github.com/jwilkicki/a321880180027dfbdb897e207e8caa0c around line 70 and beyond. My go test returned exit code 130, which seems to indicate that it got a SIGINT signal rather than failing because of a test failure.

  8. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    There seemed to be a lot of expected logging in the job, so I didn't include all of it. Basically, a bunch of messages that web console lines were being reported back to Github. I tried to just include where things started to go wrong.

  9. nikola-jokic commented on Feb 22, 2024

    @nikola-jokic
    Collaborator

    Can you please try setting requests and limits? And can you please try executing action without running your go tests? If you can execute a simple action, that would indicate the resource problem. The runner receives SIGINT, so maybe, you can see if the pod gets evicted?

  10. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    Sure, I can try that. While waiting for your suggestion, I tried switching my EKS cluster to larger nodes and I'm still hitting 103% of CPU at times. That run ended with: "Error: The operation was canceled." in the Github UI. It looks like the pod terminated after that and I have no pods running in arc-runners right now.

    I can change the workflow to just do a simple echo, but I do have a bunch of steps that do things like dump the output of docker info and those are running just fine before I get to the tests.

    Do you have a rule of thumb for what I should set the requests and limits for?

  11. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    I added in CPU and Memory limits and then used kubectl events --for to watch for events and I think I found it: the pod was evicted for the dind container using too much ephemeral storage:

    Warning   Evicted     Pod/terratesthelpers-runner-set-lqbrx-runner-mbgh4   The node was low on resource: ephemeral-storage. Threshold quantity: 3210844697, available: 2812568Ki. Container runner was using 2996460Ki, request is 0, has larger consumption of ephemeral-storage. Container dind was using 28Ki, request is 0, has larger consumption of ephemeral-storage.
    

    I'll have to see how to get more storage allocated.

  12. jwilkicki commented on Feb 22, 2024

    @jwilkicki
    Author

    Allocating more disk to my EKS nodes seems to have solved the problem. What was ultimately helpful was watching events for the runner pod, which showed the eviction for disk space usage.

    Thank your for the suggestion!

  13. emmahsax commented on Feb 28, 2024

    @emmahsax

    @jwilkicki How did you add more disk to your EKS nodes? I'm not sure how to add more ephemeral storage (or attach another PVC and storage unit).

  14. jwilkicki commented on Mar 4, 2024

    @jwilkicki
    Author

    @emmahsax Sorry for the late reply. I'm using Terraform to provision my nodes and there is a disk size parameter for the eks managed nodes. I believe this ends up going into a launch template for the autoscaling group. I think you can do it with PVC, etc. as you suggested but that seemed like a lot of effort. In my case, we have an EKS cluster dedicated for runners so I just made the actual nodes have additional disk space.

  15. noamgreen commented on Oct 12, 2024

    @noamgreen

    @nikola-jokic HI
    @jwilkicki

    This issues is not solve i am not sure why this happened , i can tell you i see it in EKS + karpenter
    but its not 100% related to EKS its the way the host are working in karpenter
    need to set "NodePool"

        kubeReserved:
          cpu: 1000m
          memory: 3000Mi
    

    but its solve part of the issues , i think you have some CPU usage as in EKS you cant over the limit so the controller will
    SIG the node and terminated this is why you dont see any error

    i can tell you 2.319.x and 2.320.x have this issues and i am sure its come from the dotnet .
    cant tell you if we upgrade this will be solved but i think this issues is need to be fixed

    in my last test i am using the docker "ghcr.io/actions/actions-runner:2.320.0"

    Thanks

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

    buggha-runner-scale-setneeds triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions