operator-lifecycle-manager icon indicating copy to clipboard operation
operator-lifecycle-manager copied to clipboard

nil pointer panic when deleting a CSV

Open matt-simons opened this issue 2 years ago • 0 comments

Bug Report

What did you do?

Deleted a CSV on our Openshift cluster

What did you expect to see?

The operator should uninstall successfully

What did you see instead? Under which circumstances?

The olm-operator goes into a crashloopbackoff because of a nil pointer

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x1b39a41]

goroutine 748 [running]:
github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm.(*Operator).transitionCSVState(_, {{{0xc000b043f0, 0x15}, {0xc000c15b20, 0x1d}}, {{0xc000b04528, 0x11}, {0x0, 0x0}, {0xc000ad0ff0, ...}, ...}, ...})
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm/operator.go:2255 +0x3e61
github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm.(*Operator).syncClusterServiceVersion(0xc000c32480, {0x2128a80?, 0xc00119dc38?})
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/olm/operator.go:1277 +0x46c
github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer.LegacySyncHandler.ToSyncerWithDelete.func1({0xc00def1da0?, 0xc00c775790?}, {0x24cd5b8, 0xc00def1da0})
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer.go:181 +0xcc
github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubestate.SyncFunc.Sync(0x1f71c20?, {0x24dd730?, 0xc00058b180?}, {0x24cd5b8?, 0xc00def1da0?})
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/kubestate/kubestate.go:184 +0x3d
github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer.(*QueueInformer).Sync(...)
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer.go:35
github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer.(*operator).processNextWorkItem(0xc000780a50, {0x24dd730, 0xc00058b180}, 0xc00030ff80)
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go:295 +0x565
github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer.(*operator).worker(0x24c0900?, {0x24dd730, 0xc00058b180}, 0xc001803140?)
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go:239 +0x45
created by github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer.(*operator).start
        /build/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/lib/queueinformer/queueinformer_operator.go:229 +0x547

This appears to be related to https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/operators/olm/operator.go#L1305

Where the CSV is nil because we deleted it on our cluster.

Environment

  • operator-lifecycle-manager version:

quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:6d27f901168dbff3eb31015b99248a4427ce2854497bf98e69603f313a7db6de

v4.13.26

  • Kubernetes version information:
kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.4", GitCommit:"872a965c6c6526caa949f0c6ac028ef7aff3fb78", GitTreeState:"clean", BuildDate:"2022-11-09T13:36:36Z", GoVersion:"go1.19.3", Compiler:"gc", Platform:"darwin/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.11+7dfc52e", GitCommit:"e294b2002b79ed1289c7f6db2e6234b1d261089f", GitTreeState:"clean", BuildDate:"2023-12-01T09:48:24Z", GoVersion:"go1.19.13 X:strictfipsruntime", Compiler:"gc", Platform:"linux/amd64"}
  • Kubernetes cluster kind:

Possible Solution

Add a check for if CSV is nil in the function

matt-simons avatar Jan 29 '24 11:01 matt-simons