actions / actions/actions-runner-controller
Setting HorizontalRunnerAutoscaler metrics scaleDownThreshold to 0 cause a segmentation fault
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.5k
- Forks
- 1.5k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 27
Description
Checks
- I've already read https://github.com/actions-runner-controller/actions-runner-controller/blob/master/TROUBLESHOOTING.md and I'm sure my issue is not covered in the troubleshooting guide.
- I'm not using a custom entrypoint in my runner image
Controller Version
0.21.1
Helm Chart Version
0.21.0
CertManager Version
1.9.1
Deployment Method
ArgoCD
cert-manager installation
- Yes
- Yes
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
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
name: infra-runner-large
spec:
scaleTargetRef:
name: infra-runner-large
scaleDownDelaySecondsAfterScaleOut: 900
minReplicas: 0
maxReplicas: 30
metrics:
- type: PercentageRunnersBusy
scaleUpThreshold: '1'
scaleDownThreshold: '0'
scaleUpFactor: '1.5'
scaleDownFactor: '0.9'
To Reproduce
1- Create the resource and corresponding runnerdeployment
2- The controller should crash
Describe the bug
The container crash with the a seg fault log.
Describe the expected behavior
The error should be more verbose and instead of crashing with a segfault tell us that the value is not valid.
Whole Controller Logs
2022-12-01T10:18:07Z INFO controller-runtime.metrics Metrics server is starting to listen {"addr": "127.0.0.1:8080"}
2022-12-01T10:18:07Z INFO actions-runner-controller Initializing actions-runner-controller {"version": "v0.26.0", "default-scale-down-delay": "10m0s", "sync-period": "1m0s", "default-runner-image": "summerwind/actions-runner:latest", "default-docker-image": "docker:dind", "common-runnner-labels": null, "leader-election-enabled": true, "leader-election-id": "actions-runner-controller", "watch-namespace": ""}
2022-12-01T10:18:07Z INFO controller-runtime.builder Registering a mutating webhook {"GVK": "actions.summerwind.dev/v1alpha1, Kind=Runner", "path": "/mutate-actions-summerwind-dev-v1alpha1-runner"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/mutate-actions-summerwind-dev-v1alpha1-runner"}
2022-12-01T10:18:07Z INFO controller-runtime.builder Registering a validating webhook {"GVK": "actions.summerwind.dev/v1alpha1, Kind=Runner", "path": "/validate-actions-summerwind-dev-v1alpha1-runner"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/validate-actions-summerwind-dev-v1alpha1-runner"}
2022-12-01T10:18:07Z INFO controller-runtime.builder Registering a mutating webhook {"GVK": "actions.summerwind.dev/v1alpha1, Kind=RunnerDeployment", "path": "/mutate-actions-summerwind-dev-v1alpha1-runnerdeployment"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/mutate-actions-summerwind-dev-v1alpha1-runnerdeployment"}
2022-12-01T10:18:07Z INFO controller-runtime.builder Registering a validating webhook {"GVK": "actions.summerwind.dev/v1alpha1, Kind=RunnerDeployment", "path": "/validate-actions-summerwind-dev-v1alpha1-runnerdeployment"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/validate-actions-summerwind-dev-v1alpha1-runnerdeployment"}
2022-12-01T10:18:07Z INFO controller-runtime.builder Registering a mutating webhook {"GVK": "actions.summerwind.dev/v1alpha1, Kind=RunnerReplicaSet", "path": "/mutate-actions-summerwind-dev-v1alpha1-runnerreplicaset"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/mutate-actions-summerwind-dev-v1alpha1-runnerreplicaset"}
2022-12-01T10:18:07Z INFO controller-runtime.builder Registering a validating webhook {"GVK": "actions.summerwind.dev/v1alpha1, Kind=RunnerReplicaSet", "path": "/validate-actions-summerwind-dev-v1alpha1-runnerreplicaset"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/validate-actions-summerwind-dev-v1alpha1-runnerreplicaset"}
2022-12-01T10:18:07Z INFO controller-runtime.webhook Registering webhook {"path": "/mutate-runner-set-pod"}
2022-12-01T10:18:07Z INFO actions-runner-controller starting manager
2022-12-01T10:18:07Z INFO controller-runtime.webhook.webhooks Starting webhook server
2022-12-01T10:18:07Z INFO Starting server {"path": "/metrics", "kind": "metrics", "addr": "127.0.0.1:8080"}
2022-12-01T10:18:07Z INFO controller-runtime.certwatcher Updated current TLS certificate
2022-12-01T10:18:07Z INFO controller-runtime.webhook Serving webhook server {"host": "", "port": 9443}
2022-12-01T10:18:07Z INFO controller-runtime.certwatcher Starting certificate watcher
I1201 10:18:07.324149 1 leaderelection.go:248] attempting to acquire leader lease github-runner/actions-runner-controller...
I1201 10:18:24.743082 1 leaderelection.go:258] successfully acquired lease github-runner/actions-runner-controller
2022-12-01T10:18:24Z DEBUG events Normal {"object": {"kind":"Lease","namespace":"github-runner","name":"actions-runner-controller","uid":"0a14c8b7-f528-4b94-b8a5-e27d4f984830","apiVersion":"coordination.k8s.io/v1","resourceVersion":"576625600"}, "reason": "LeaderElection", "message": "github-runner-actions-runner-controller-69f7468d5d-gwkp2_3d63d60a-867f-4e55-a434-6047862c5f4e became leader"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runner-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "Runner", "source": "kind source: *v1alpha1.Runner"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runner-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "Runner", "source": "kind source: *v1.Pod"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runner-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "Runner"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerreplicaset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerReplicaSet", "source": "kind source: *v1alpha1.RunnerReplicaSet"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerreplicaset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerReplicaSet", "source": "kind source: *v1alpha1.Runner"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerSet", "source": "kind source: *v1alpha1.RunnerSet"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerSet", "source": "kind source: *v1.StatefulSet"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runnerset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerSet"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runnerreplicaset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerReplicaSet"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerpersistentvolume-controller", "controllerGroup": "", "controllerKind": "PersistentVolume", "source": "kind source: *v1.PersistentVolume"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runnerpersistentvolume-controller", "controllerGroup": "", "controllerKind": "PersistentVolume"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerdeployment-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerDeployment", "source": "kind source: *v1alpha1.RunnerDeployment"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "horizontalrunnerautoscaler-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "HorizontalRunnerAutoscaler", "source": "kind source: *v1alpha1.HorizontalRunnerAutoscaler"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "horizontalrunnerautoscaler-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "HorizontalRunnerAutoscaler"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerdeployment-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerDeployment", "source": "kind source: *v1alpha1.RunnerReplicaSet"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerpersistentvolumeclaim-controller", "controllerGroup": "", "controllerKind": "PersistentVolumeClaim", "source": "kind source: *v1.PersistentVolumeClaim"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runnerpersistentvolumeclaim-controller", "controllerGroup": "", "controllerKind": "PersistentVolumeClaim"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runnerdeployment-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerDeployment"}
2022-12-01T10:18:24Z INFO Starting EventSource {"controller": "runnerpod-controller", "controllerGroup": "", "controllerKind": "Pod", "source": "kind source: *v1.Pod"}
2022-12-01T10:18:24Z INFO Starting Controller {"controller": "runnerpod-controller", "controllerGroup": "", "controllerKind": "Pod"}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runnerpod-controller", "controllerGroup": "", "controllerKind": "Pod", "worker count": 1}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runnerpersistentvolumeclaim-controller", "controllerGroup": "", "controllerKind": "PersistentVolumeClaim", "worker count": 1}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runnerreplicaset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerReplicaSet", "worker count": 1}
2022-12-01T10:18:24Z DEBUG actions-runner-controller.runnerreplicaset Skipped reconcilation because owner is not synced yet {"runnerreplicaset": "github-runner/infra-runner-small-8g8x6", "owner": "github-runner/infra-runner-small-8g8x6-nrt5j", "pods": null}
2022-12-01T10:18:24Z DEBUG actions-runner-controller.runnerreplicaset Skipped reconcilation because owner is not synced yet {"runnerreplicaset": "github-runner/infra-runner-large-vvr82", "owner": "github-runner/infra-runner-large-vvr82-tw9dd", "pods": null}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runner-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "Runner", "worker count": 1}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "horizontalrunnerautoscaler-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "HorizontalRunnerAutoscaler", "worker count": 1}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runnerpersistentvolume-controller", "controllerGroup": "", "controllerKind": "PersistentVolume", "worker count": 1}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runnerdeployment-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerDeployment", "worker count": 1}
2022-12-01T10:18:24Z INFO Starting workers {"controller": "runnerset-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "RunnerSet", "worker count": 1}
2022-12-01T10:18:24Z DEBUG controller-runtime.webhook.webhooks received request {"webhook": "/mutate-runner-set-pod", "UID": "80a4fbdd-f0dc-433e-8ca9-2b07ccf6cb24", "kind": "/v1, Kind=Pod", "resource": {"group":"","version":"v1","resource":"pods"}}
2022-12-01T10:18:24Z DEBUG controller-runtime.webhook.webhooks received request {"webhook": "/mutate-actions-summerwind-dev-v1alpha1-runner", "UID": "9fe8c841-2f2e-4bca-a797-df88005f3a14", "kind": "actions.summerwind.dev/v1alpha1, Kind=Runner", "resource": {"group":"actions.summerwind.dev","version":"v1alpha1","resource":"runners"}}
2022-12-01T10:18:24Z DEBUG controller-runtime.webhook.webhooks wrote response {"webhook": "/mutate-actions-summerwind-dev-v1alpha1-runner", "code": 200, "reason": "", "UID": "9fe8c841-2f2e-4bca-a797-df88005f3a14", "allowed": true}
2022-12-01T10:18:24Z DEBUG controller-runtime.webhook.webhooks received request {"webhook": "/validate-actions-summerwind-dev-v1alpha1-runner", "UID": "0016d3ca-cdcc-4163-b770-5fcea23c58b8", "kind": "actions.summerwind.dev/v1alpha1, Kind=Runner", "resource": {"group":"actions.summerwind.dev","version":"v1alpha1","resource":"runners"}}
2022-12-01T10:18:24Z INFO runner-resource validate resource to be created {"name": "infra-runner-medium-hvb2t-jbhjp"}
2022-12-01T10:18:24Z DEBUG controller-runtime.webhook.webhooks wrote response {"webhook": "/validate-actions-summerwind-dev-v1alpha1-runner", "code": 200, "reason": "", "UID": "0016d3ca-cdcc-4163-b770-5fcea23c58b8", "allowed": true}
2022-12-01T10:18:25Z DEBUG actions-runner-controller.runnerreplicaset Created replica(s) {"runnerreplicaset": "github-runner/infra-runner-medium-hvb2t", "lastSyncTime": null, "effectiveTime": "<nil>", "templateHashDesired": "78d4d4cdc6", "replicasDesired": 1, "replicasPending": 0, "replicasRunning": 0, "replicasMaybeRunning": 0, "templateHashObserved": [], "created": 1}
2022-12-01T10:18:25Z DEBUG actions-runner-controller.runnerreplicaset Skipped reconcilation because owner is not synced yet {"runnerreplicaset": "github-runner/infra-runner-medium-hvb2t", "owner": "github-runner/infra-runner-medium-hvb2t-jbhjp", "pods": null}
2022-12-01T10:18:25Z DEBUG controller-runtime.webhook.webhooks wrote response {"webhook": "/mutate-runner-set-pod", "code": 200, "reason": "", "UID": "80a4fbdd-f0dc-433e-8ca9-2b07ccf6cb24", "allowed": true}
2022-12-01T10:18:25Z INFO Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference {"controller": "horizontalrunnerautoscaler-controller", "controllerGroup": "actions.summerwind.dev", "controllerKind": "HorizontalRunnerAutoscaler", "horizontalRunnerAutoscaler": {"name":"infra-runner-large","namespace":"github-runner"}, "namespace": "github-runner", "name": "infra-runner-large", "reconcileID": "8b7d5e23-31c0-45a7-a648-e9cc3e817a7b"}
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x144ab8b]
goroutine 531 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/controller/controller.go:118 +0x1f4
panic({0x1617ee0, 0x263f760})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/actions-runner-controller/actions-runner-controller/controllers.(*HorizontalRunnerAutoscalerReconciler).suggestReplicasByPercentageRunnersBusy(_, _, {{0xc00046a210, 0x12}, {0x183f9f5, 0x10}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...)
/workspace/controllers/autoscaling.go:393 +0xacb
github.com/actions-runner-controller/actions-runner-controller/controllers.(*HorizontalRunnerAutoscalerReconciler).suggestDesiredReplicas(_, _, {{0xc00046a210, 0x12}, {0x183f9f5, 0x10}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...)
/workspace/controllers/autoscaling.go:55 +0x308
github.com/actions-runner-controller/actions-runner-controller/controllers.(*HorizontalRunnerAutoscalerReconciler).computeReplicasWithCache(_, _, {{_, _}, _}, {_, _, _}, {{0xc00046a210, 0x12}, ...}, ...)
/workspace/controllers/horizontalrunnerautoscaler_controller.go:473 +0xd8
github.com/actions-runner-controller/actions-runner-controller/controllers.(*HorizontalRunnerAutoscalerReconciler).reconcile(_, {_, _}, {{{_, _}, {_, _}}}, {{0x1a9b228, 0xc00160f6b0}, 0x0}, ...)
/workspace/controllers/horizontalrunnerautoscaler_controller.go:319 +0x22b
github.com/actions-runner-controller/actions-runner-controller/controllers.(*HorizontalRunnerAutoscalerReconciler).Reconcile(0xc00011fec0, {0x1a98998?, 0xc00160f680}, {{{0xc000589b30, 0xd}, {0xc000571380, 0x12}}})
/workspace/controllers/horizontalrunnerautoscaler_controller.go:100 +0x98c
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x1a988f0?, {0x1a98998?, 0xc00160f680?}, {{{0xc000589b30?, 0x175eea0?}, {0xc000571380?, 0x4045d4?}}})
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/controller/controller.go:121 +0xc8
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000432960, {0x1a988f0, 0xc000552cc0}, {0x16891c0?, 0xc000b08b40?})
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/controller/controller.go:320 +0x33c
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000432960, {0x1a988f0, 0xc000552cc0})
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/controller/controller.go:273 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/controller/controller.go:234 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/internal/controller/controller.go:230 +0x333
Whole Runner Pod Logs
irrelevant
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the crash with the HorizontalRunnerAutoscaler resource definition shown, focusing on the horizontalrunnerautoscaler-controller entry point named in the logs. Trace handling of the PercentageRunnersBusy metric and its scaleDownThreshold value; done means the invalid value produces a clear validation error instead of a segmentation fault, with a regression test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100