Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Conversation

croomes
Copy link
Contributor

@croomes croomes commented May 14, 2019

Fixes panic:

2019/05/14 14:59:45 Go Version: go1.11.5
2019/05/14 14:59:45 Go OS/Arch: linux/amd64
2019/05/14 14:59:45 operator-sdk Version: v0.3.0
2019/05/14 14:59:45 Registering Components.
2019/05/14 14:59:45 k8s version: v1.13.4+8cd4e29
2019/05/14 14:59:45 Starting the Cmd.
E0514 14:59:45.619311       1 runtime.go:66] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:72
/go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:65
/go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:51
/usr/local/go/src/runtime/asm_amd64.s:522
/usr/local/go/src/runtime/panic.go:513
/usr/local/go/src/runtime/panic.go:82
/usr/local/go/src/runtime/signal_unix.go:390
/go/src/github.com/storageos/cluster-operator/pkg/controller/node/node_controller.go:134
/go/src/github.com/storageos/cluster-operator/pkg/controller/node/node_controller.go:118
/go/src/github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:215
/go/src/github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158
/go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133
/go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134
/go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88
/usr/local/go/src/runtime/asm_amd64.s:1333
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=0xfd6c9d]
goroutine 232 [running]:
github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
    /go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:58 +0x108
panic(0x1171f00, 0x1f0fe00)
    /usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/storageos/cluster-operator/pkg/controller/node.(*ReconcileNode).syncLabels(0xc0004346c0, 0xc0006beba0, 0x28, 0xc000411830, 0x0, 0x0)
    /go/src/github.com/storageos/cluster-operator/pkg/controller/node/node_controller.go:134 +0x8d
github.com/storageos/cluster-operator/pkg/controller/node.(*ReconcileNode).Reconcile(0xc0004346c0, 0x0, 0x0, 0xc0006beba0, 0x28, 0x1f23900, 0xc0000dc960, 0xc000624d40, 0x4057bb)
    /go/src/github.com/storageos/cluster-operator/pkg/controller/node/node_controller.go:118 +0x342
github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000348140, 0x0)
    /go/src/github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:215 +0x18f
github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1()
    /go/src/github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158 +0x36
github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1(0xc00042f200)
    /go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x54
github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc00042f200, 0x3b9aca00, 0x0, 0x1, 0xc00014e6c0)
    /go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134 +0xbe
github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait.Until(0xc00042f200, 0x3b9aca00, 0xc00014e6c0)
    /go/src/github.com/storageos/cluster-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88 +0x4d
created by github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start
    /go/src/github.com/storageos/cluster-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:157 +0x32a

@croomes croomes requested review from darkowlzz and domodwyer May 14, 2019 16:03
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!


if err := r.setClientForCluster(cluster); err != nil {
log.Println("failed to configure api client:", err)
return reconcileResult, err
Copy link
Contributor

Choose a reason for hiding this comment

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

This is much better 👍 return error and requeue the request.
I missed error checking 😅

if r.stosClient == nil {
return ErrNoAPIClient
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. We need to add more tests for the functions in each of the controllers. pkg/controller/storageoscluster/storageoscluster_controller_test.go has some tests for the cluster controller.

@croomes croomes merged commit f3a7639 into master May 15, 2019
@darkowlzz darkowlzz deleted the bugfix/node-panic branch May 15, 2019 12:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants