You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "Diesel93 (via GitHub)" <gi...@apache.org> on 2026/04/27 11:08:51 UTC
[I] Build controller panics with nil pointer dereference on every build in 2.10.0 [camel-k]
Diesel93 opened a new issue, #6587:
URL: https://github.com/apache/camel-k/issues/6587
**Camel K version:** 2.10.0 (Helm chart)
**Kubernetes:** EKS 1.31, eu-west-2
After upgrading from 2.8.0 to 2.10.0 the operator panics on every build. The build pod never spawns — the reconcile loop crashes and retries indefinitely.
**Operator logs:**
```
{"level":"error","msg":"Observed a panic","controller":"build-controller","Build":{"name":"kit-d7njpnevtj8s73903ip0","namespace":"camel-k"},"panic":"runtime error: invalid memory address or nil pointer dereference"}
{"level":"error","msg":"Reconciler error","error":"panic: runtime error: invalid memory address or nil pointer dereference [recovered]"}
```
Always the same sequence — build queues fine, then immediately panics:
```
INFO | Invoking action build
INFO | State transition
INFO | Build queue duration 357ms
INFO | Invoking action build
ERROR | Observed a panic
```
**Stack trace:**
```
github.com/apache/camel-k/v2/pkg/apis/camel/v1.(*Build).GetObjectKind
k8s.io/client-go/tools/reference.GetReference
k8s.io/client-go/tools/events.(*recorderImpl).eventf
github.com/apache/camel-k/v2/pkg/event/manager.go:210
github.com/apache/camel-k/v2/pkg/controller/build/build_controller.go:196
```
**Root cause:**
PR #6492 bumped controller-runtime to 0.23.1 and migrated from `record.EventRecorder` to `events.EventRecorder`. The new recorder calls `reference.GetReference(scheme, obj)` which calls `obj.GetObjectKind()`. Since `client.Get()` strips `TypeMeta` from returned objects (known controller-runtime behaviour — kubernetes-sigs/controller-runtime#1735), `GetObjectKind()` ends up dereferencing a nil pointer.
The old `record.EventRecorder` didn't go through `GetReference` so this wasn't an issue in 2.9.x.
**Reproducing:**
Install 2.10.0 via Helm and trigger any build. Panic happens on the first state transition event after the build queues — doesn't matter what registry or build strategy.
Works fine on 2.9.1, broken on 2.10.0.
**Fix:**
Populate `TypeMeta` on the Build object before it reaches the event recorder, e.g. in `build_controller.go`:
```go
instance.TypeMeta = metav1.TypeMeta{
Kind: "Build",
APIVersion: "camel.apache.org/v1",
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Build controller panics with nil pointer dereference on every build in 2.10.0 [camel-k]
Posted by "Diesel93 (via GitHub)" <gi...@apache.org>.
Diesel93 commented on issue #6587:
URL: https://github.com/apache/camel-k/issues/6587#issuecomment-4334899589
Thanks for the quick response.
I dug into the difference between Helm and Kustomize installs. I don't think it's actually installation-method specific — I think the e2e tests just don't exercise the code path that triggers it.
The panic is a Go typed-nil-interface issue in `NotifyError` in `pkg/event/manager.go`:
```go
func NotifyError(recorder events.EventRecorder, old, newResource runtime.Object, ...) {
res := old
if newResource != nil { res = newResource } // ← doesn't catch typed nil
recorder.Eventf(res, nil, ...)
```
In `build_controller.go`, actions that return `(nil, err)` pass a typed nil `*v1.Build` as `newResource`. When wrapped in a `runtime.Object` interface, `newResource != nil` evaluates to `true` even though the underlying pointer is nil. So `res` becomes a nil pointer wrapped in an interface, and `recorder.Eventf` → `GetReference` → `GetObjectKind()` panics.
The e2e tests likely don't hit this because they run in a clean environment where actions succeed on the happy path. In a real cluster, any transient error from an action (API server, RBAC, registry) triggers the `return nil, err` path and you hit the panic.
The fix would be either:
- Use reflect to properly check for typed nil in `NotifyError`: `!reflect.ValueOf(newResource).IsNil()`
- Or change the callers to pass an untyped `nil` instead of a typed `*v1.Build` nil
Happy to test a fix if you want to put up a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Build controller panics with nil pointer dereference on every build in 2.10.0 [camel-k]
Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez closed issue #6587: Build controller panics with nil pointer dereference on every build in 2.10.0
URL: https://github.com/apache/camel-k/issues/6587
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Build controller panics with nil pointer dereference on every build in 2.10.0 [camel-k]
Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #6587:
URL: https://github.com/apache/camel-k/issues/6587#issuecomment-4326581827
Thanks for reporting. I wonder if this is only happening with Helm installation procedure. We have e2e tests for `pod` strategy with Kustomization installation procedure though, and it is working fine apparently. Can you verify if you're able to reproduce with Kustomization as well? and surely a PR is welcome if you have time to contribute.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Build controller panics with nil pointer dereference on every build in 2.10.0 [camel-k]
Posted by "Diesel93 (via GitHub)" <gi...@apache.org>.
Diesel93 commented on issue #6587:
URL: https://github.com/apache/camel-k/issues/6587#issuecomment-4335407065
Dug into this a bit more — it's not Helm specific. The panic is a Go typed-nil-interface issue in `NotifyError`. When an action returns `(nil, err)`, the typed nil `*v1.Build` passes the `newResource != nil` check because the interface has type information even though the pointer is nil. This then panics in `recorder.Eventf` → `GetReference` → `GetObjectKind()`.
Tested a fix on a live cluster — PR up at #6589.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org