Skip to content

actions-metrics-server segfaults at random #2309

Closed

Description

@endriu0

Checks

Controller Version

2.299.1-ubuntu-20.04-aa6dab5

Helm Chart Version

0.22.0

CertManager Version

1.11.0

Deployment Method

ArgoCD

cert-manager installation

  • Cert manager installed from upstream chart - confirmed it's official
  • We did follow the setup at the beginning / since then we've changed things around but are back to very similar setup to upstream with minor diff

Checks

  • This isn't a question or user support case (For Q&A and community support, go to Discussions. It might also be a good idea to contract with any of contributors and maintainers if your business is so critical and therefore you need priority support
  • I've read releasenotes before submitting this issue and I'm sure it's not due to any recently-introduced backward-incompatible changes
  • My actions-runner-controller version (v0.x.y) does support the feature
  • I've already upgraded ARC (including the CRDs, see charts/actions-runner-controller/docs/UPGRADING.md for details) to the latest and it didn't fix the issue
  • I've migrated to the workflow job webhook event (if you using webhook driven scaling)

Resource Definitions

Not a problem with runners per se - problem with actions-metrics-server

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: github-runner-controller
    app.kubernetes.io/version: 0.27.0
    helm.sh/chart: actions-runner-controller-0.22.0
  name: actions-metrics
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: actions-metrics-server
      app.kubernetes.io/name: actions-runner-controller
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: actions-metrics-server
        app.kubernetes.io/name: actions-runner-controller
    spec:
      containers:
      - args:
        - --metrics-addr=0.0.0.0:8443
        - --log-format=text
        command:
        - /actions-metrics-server
        env:
        - name: GITHUB_WEBHOOK_SECRET_TOKEN
          valueFrom:
            secretKeyRef:
              key: github_webhook_secret_token
              name: actions-metrics-server
              optional: true
        - name: GITHUB_ENTERPRISE_URL
          value: redacted
        - name: GITHUB_TOKEN
          valueFrom:
            secretKeyRef:
              key: github_token
              name: controller-manager
              optional: true
        - name: GITHUB_APP_ID
          valueFrom:
            secretKeyRef:
              key: github_app_id
              name: controller-manager
              optional: true
        - name: GITHUB_APP_INSTALLATION_ID
          valueFrom:
            secretKeyRef:
              key: github_app_installation_id
              name: controller-manager
              optional: true
        - name: GITHUB_APP_PRIVATE_KEY
          valueFrom:
            secretKeyRef:
              key: github_app_private_key
              name: controller-manager
              optional: true
        - name: GITHUB_BASICAUTH_PASSWORD
          valueFrom:
            secretKeyRef:
              key: github_basicauth_password
              name: controller-manager
              optional: true
        image: summerwind/actions-runner-controller:v0.27.0
        imagePullPolicy: IfNotPresent
        name: actions-metrics-server
        ports:
        - containerPort: 8000
          name: http
          protocol: TCP
        - containerPort: 8443
          name: metrics-port
          protocol: TCP
        resources: {}
        securityContext: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: actions-metrics
      serviceAccountName: actions-metrics
      terminationGracePeriodSeconds: 10

To Reproduce

1. Run actions-metrics-server with webhook from GHES
2. Observe segfaults seemingly at random intervals after webhook is received - different jobs trigger this

Describe the bug

Getting below at random:

"panic: runtime error: invalid memory address or nil pointer dereference"
"[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1344074]"
"goroutine 71 [running]:"
"github.com/actions/actions-runner-controller/pkg/actionsmetrics.(*EventReader).ProcessWorkflowJobEvent(0xc000272000, {0x18c4650, 0xc0002fe000}, {0x152af80?, 0xc002b03470})"
"\tgithub.com/actions/actions-runner-controller/pkg/actionsmetrics/event_reader.go:123 +0xad4"
"github.com/actions/actions-runner-controller/pkg/actionsmetrics.(*EventReader).ProcessWorkflowJobEvents(0xc000272000, {0x18c4650, 0xc0002fe000})"
"\tgithub.com/actions/actions-runner-controller/pkg/actionsmetrics/event_reader.go:44 +0x59"
"main.main.func1()"
"\tgithub.com/actions/actions-runner-controller/cmd/actionsmetricsserver/main.go:157 +0x6c"
"created by main.main"
"\tgithub.com/actions/actions-runner-controller/cmd/actionsmetricsserver/main.go:154 +0xdef"

After the pod restarts it keeps running again with no issues.

Describe the expected behavior

Container doesn't segfault at random

Whole Controller Logs

n/a too random to catch it in the act

Whole Runner Pod Logs

Since this is metrics-server issue not able to pinpoint specific runner pod causing this if any.

Additional Context

Run into SIGSEGV on the beginning before adding credentials to the actions-metrics-server pod. Since then the above SIGSEGV only happened 4 times in space of a day and all of them within 2 hours. Will try to catch it in the act to try and narrow down but decided to open an issue in case if anybody else is running into this.

Activity

  1. added
    bug
    needs triage
    on Feb 22, 2023
  2. github-actions commented on Feb 22, 2023

    @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. ozlotusflare commented on Feb 23, 2023

    @ozlotusflare

    Hey @endriu0
    Maybe you already faced with this type of error in actions-metrics-server

    2023-02-23T22:40:52Z	ERROR	workflowjobmetrics-webhookserver	error validating request body	{"error": "payload signature check failed"}
    32
    github.com/actions/actions-runner-controller/pkg/actionsmetrics.(*WebhookServer).Handle
    31
    	github.com/actions/actions-runner-controller/pkg/actionsmetrics/webhookserver.go:93
    30
    net/http.HandlerFunc.ServeHTTP
    29
    	net/http/server.go:2109
    28
    net/http.(*ServeMux).ServeHTTP
    27
    	net/http/server.go:2487
    26
    net/http.serverHandler.ServeHTTP
    25
    	net/http/server.go:2947
    24
    net/http.(*conn).serve
    23
    	net/http/server.go:1991
    

    I've provided webhoock secret token, but still the same error :/
    Thank you and sorry for offtop

  4. mumoshu commented on Feb 26, 2023

    @mumoshu
    Collaborator

    Hey @endriu0 and @ozlotusflare! Thanks for reporting this.
    According to the logs, it's failing at:

    if *step.Conclusion == "failure" {

    It might indicate that step.conclusion can be empty for some workflow job events emitted by GitHub, although I don't know exactly which case it might happen.
    In the meantime, the best we could do might be to add a nil check, so that it skips the problematic "step" object in the webhook event.

  5. added a commit that references this issue on Feb 26, 2023
    ac2a678
  6. mumoshu commented on Feb 26, 2023

    @mumoshu
    Collaborator

    Please see #2325 for the fix

  7. endriu0 commented on Feb 27, 2023

    @endriu0
    Author

    Thank you @mumoshu.

  8. endriu0 commented on Feb 27, 2023

    @endriu0
    Author

    payload signature check fai

    Hey @ozlotusflare , unfortunately we're not using secret for our webhooks due to everything being internal but if I were to guess then something is up with the secret.

    Maybe double check that the secret doesn't by any chance have newline at the end (run into this before) . On Mac there's a diff between running 'echo "something" | base64' and 'echo -n "something" | base64'

  9. ozlotusflare commented on Feb 27, 2023

    @ozlotusflare

    @endriu0 thank you!
    I will take a look 🙂

  10. ivanivicrho commented on Mar 14, 2023

    @ivanivicrho

    For me, it always fails for workflow_job.completed event. Logs from actions-metrics-server:

    {"severity":"info","ts":1678815874.8492563,"logger":"workflowjobmetrics-webhookserver","message":"ok","event":"workflow_job","hookID":"xxxx","delivery":"yyyyy"}
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1344519]
    
    goroutine 12 [running]:
    github.com/actions/actions-runner-controller/pkg/actionsmetrics.(*EventReader).fetchAndParseWorkflowJobLogs(0x14ba860?, {0x18c4650?, 0xc0005b2480?}, 0xe?)
    	github.com/actions/actions-runner-controller/pkg/actionsmetrics/event_reader.go:167 +0x59
    github.com/actions/actions-runner-controller/pkg/actionsmetrics.(*EventReader).ProcessWorkflowJobEvent(0xc00057c4e0, {0x18c4650, 0xc0005b2480}, {0x152af80?, 0xc000131530})
    	github.com/actions/actions-runner-controller/pkg/actionsmetrics/event_reader.go:99 +0x6e5
    github.com/actions/actions-runner-controller/pkg/actionsmetrics.(*EventReader).ProcessWorkflowJobEvents(0xc00057c4e0, {0x18c4650, 0xc0005b2480})
    	github.com/actions/actions-runner-controller/pkg/actionsmetrics/event_reader.go:44 +0x59
    main.main.func1()
    	github.com/actions/actions-runner-controller/cmd/actionsmetricsserver/main.go:157 +0x6c
    created by main.main
    	github.com/actions/actions-runner-controller/cmd/actionsmetricsserver/main.go:154 +0xdef
    

    Image is summerwind/actions-runner-controller:v0.27.0. Installation is just basic helm chart installation:

    actionsMetricsServer:
      enabled: true
      logFormat: json
      ingress:
        enabled: true
        [ removed ]
        ....
      secret:
        enabled: true
    
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

    bugneeds triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions