Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[memcached]Fix nil dereference during Service create #179

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

gibizer
Copy link
Contributor

@gibizer gibizer commented Feb 13, 2024

When service creation fails the reconciler uses the err variable but the error is stored in serr instead so err is nil.

2024-02-13T16:31:10Z	INFO	Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference	{"controller": "memcached", "controllerGroup": "memcached.openstack.org", "controllerKind": "Memcached", "Memcached": {"name":"memcached","namespace":"openstack"}, "namespace": "openstack", "name": "memcached", "reconcileID": "f293fe77-a1f7-4b39-8741-f357073ca685"}
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=0x18 pc=0x16345f1]

goroutine 512 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:119 +0x1fa
panic({0x181abc0, 0x2956790})
	/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/openstack-k8s-operators/infra-operator/controllers/memcached.(*Reconciler).Reconcile(0xc0005b2e40, {0x1ccef58, 0xc0020e9d10}, {{{0xc0041f4f40?, 0x9?}, {0xc0041f4fd0?, 0x9?}}})
	/remote-source/controllers/memcached/memcached_controller.go:220 +0x1191
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x1ccef58?, {0x1ccef58?, 0xc0020e9d10?}, {{{0xc0041f4f40?, 0x1750940?}, {0xc0041f4fd0?, 0x0?}}})
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:122 +0xc8
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0004477c0, {0x1cceeb0, 0xc00087aa40}, {0x1893880?, 0xc002464060?})
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:323 +0x3a5
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0004477c0, {0x1cceeb0, 0xc00087aa40})
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:274 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:235 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
	/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:231 +0x333

When service creation fails the reconciler uses the `err` variable but
the error is stored in `serr` instead so `err` is nil.
@gibizer gibizer requested a review from dciabrin February 13, 2024 16:40
Copy link
Contributor

@stuggi stuggi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Contributor

openshift-ci bot commented Feb 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gibizer, stuggi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit e338bce into openstack-k8s-operators:main Feb 13, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants