Skip to content

panic: runtime error: invalid memory address or nil pointer dereference in identitygc #45087

@tsotne95

Description

@tsotne95

Is there an existing issue for this?

  • I have searched the existing issues

Version

equal or higher than v1.17.14 and lower than v1.18.0

What happened?

1 of our test I noticed cilium operator crash:

ERROR 2026-03-26T17:33:44.180705521Z panic: runtime error: invalid memory address or nil pointer dereference
ERROR 2026-03-26T17:33:44.180707598Z [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe40b24]
ERROR 2026-03-26T17:33:44.180709141Z {}
ERROR 2026-03-26T17:33:44.180710811Z goroutine 1 [running]:
ERROR 2026-03-26T17:33:44.180712418Z github.com/cilium/cilium/pkg/controller.(*Manager).removeAll(0x0)
ERROR 2026-03-26T17:33:44.180714001Z /go/src/github.com/cilium/cilium/pkg/controller/manager.go:222 +0x34
ERROR 2026-03-26T17:33:44.180715666Z github.com/cilium/cilium/pkg/controller.(*Manager).RemoveAllAndWait(...)
ERROR 2026-03-26T17:33:44.180717273Z /go/src/github.com/cilium/cilium/pkg/controller/manager.go:245
ERROR 2026-03-26T17:33:44.180718824Z github.com/cilium/cilium/operator/identitygc.registerGC.func2({0x14e21b68b4b8?, 0x5b7834?})
ERROR 2026-03-26T17:33:44.180720370Z /go/src/github.com/cilium/cilium/operator/identitygc/gc.go:148 +0xa8
ERROR 2026-03-26T17:33:44.180721999Z github.com/cilium/hive/cell.Hook.Stop(...)
ERROR 2026-03-26T17:33:44.180723872Z /go/src/github.com/cilium/cilium/vendor/github.com/cilium/hive/cell/lifecycle.go:50
ERROR 2026-03-26T17:33:44.180725489Z github.com/cilium/hive/cell.(*DefaultLifecycle).Stop(0x14e21b16c870, 0x14e21ad0a0c0, {0x3716130?, 0x14e21b81d0e0?})
ERROR 2026-03-26T17:33:44.180731543Z /go/src/github.com/cilium/cilium/vendor/github.com/cilium/hive/cell/lifecycle.go:167 +0x268
ERROR 2026-03-26T17:33:44.180732944Z github.com/cilium/cilium/operator/cmd.registerOperatorHooks.func2({0xfd01862ee358?, 0x14e21b81d0e0?})
ERROR 2026-03-26T17:33:44.180734238Z /go/src/github.com/cilium/cilium/operator/cmd/root.go:402 +0x64
ERROR 2026-03-26T17:33:44.180735484Z github.com/cilium/hive/cell.Hook.Stop(...)
ERROR 2026-03-26T17:33:44.180736806Z /go/src/github.com/cilium/cilium/vendor/github.com/cilium/hive/cell/lifecycle.go:50
ERROR 2026-03-26T17:33:44.180738288Z github.com/cilium/hive/cell.(*DefaultLifecycle).Stop(0x14e21ab9f980, 0x14e21a430380, {0x37161a0?, 0x14e21a464bd0?})
ERROR 2026-03-26T17:33:44.180750262Z /go/src/github.com/cilium/cilium/vendor/github.com/cilium/hive/cell/lifecycle.go:167 +0x268
ERROR 2026-03-26T17:33:44.180751732Z github.com/cilium/hive.(*Hive).Stop(0x14e21a9bb590, 0x14e21a430380, {0x37161a0, 0x14e21a464bd0})
ERROR 2026-03-26T17:33:44.180753084Z /go/src/github.com/cilium/cilium/vendor/github.com/cilium/hive/hive.go:403 +0xcc
ERROR 2026-03-26T17:33:44.180754437Z github.com/cilium/hive.(*Hive).Run(0x14e21a9bb590, 0x14e21a430380, {0x0, 0x0, 0x0?})
ERROR 2026-03-26T17:33:44.180755800Z /go/src/github.com/cilium/cilium/vendor/github.com/cilium/hive/hive.go:274 +0x4cc
ERROR 2026-03-26T17:33:44.180757228Z github.com/cilium/cilium/operator/cmd.NewOperatorCmd.func1(0x14e21af31900?, {0x34c1aa5?, 0x4?, 0x34c19bd?})
ERROR 2026-03-26T17:33:44.180758585Z /go/src/github.com/cilium/cilium/operator/cmd/root.go:346 +0xa8
ERROR 2026-03-26T17:33:44.180759879Z github.com/spf13/cobra.(*Command).execute(0x14e21ac90008, {0x14e21a01d870, 0x1c, 0x1d})
ERROR 2026-03-26T17:33:44.180761093Z /go/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:1019 +0x7fc
ERROR 2026-03-26T17:33:44.180762251Z github.com/spf13/cobra.(*Command).ExecuteC(0x14e21ac90008)
ERROR 2026-03-26T17:33:44.180763522Z /go/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:1148 +0x350
ERROR 2026-03-26T17:33:44.180764688Z github.com/spf13/cobra.(*Command).Execute(...)
ERROR 2026-03-26T17:33:44.180765932Z /go/src/github.com/cilium/cilium/vendor/github.com/spf13/cobra/command.go:1071
ERROR 2026-03-26T17:33:44.180767129Z github.com/cilium/cilium/operator/cmd.Execute(0x14e21a9bb590?)
ERROR 2026-03-26T17:33:44.180768317Z /go/src/github.com/cilium/cilium/operator/cmd/root.go:384 +0x1c
ERROR 2026-03-26T17:33:44.180769548Z main.main()

exact cilium version used in test was 1.18.7 (but as I see the problem is even lower and current main branch too)

How can we reproduce the issue?

The cilium-operator crashes with a nil pointer dereference during shutdown if the Identity Garbage Collection was skipped or returned early during startup (e.g. when --disable-endpoint-crd=true and the CiliumEndpoint CRD is missing from the cluster). Later was the case of the crash I noticed.

Cilium Version

1.18.7

Kernel Version

6.12

Kubernetes Version

1.35

Regression

No response

Sysdump

No response

Relevant log output

Anything else?

No response

Cilium Users Document

  • Are you a user of Cilium? Please add yourself to the Users doc

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/operatorImpacts the cilium-operator componentkind/bugThis is a bug in the Cilium logic.kind/community-reportThis was reported by a user in the Cilium community, eg via Slack.needs/triageThis issue requires triaging to establish severity and next steps.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions