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

Fix the nil pointer dereference panic issue #761

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wenqiq
Copy link
Contributor

@wenqiq wenqiq commented Sep 11, 2024

  1. Fix the nil pointer dereference panic issue when handling the NSX return values
2024-09-12 09:30:54.238 ESC[34mINFOESC[0m       ESC[33mcontroller/controller.go:110ESC[0m       Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference        {"controller": "networkinfo", "controllerGroup": "crd.nsx.vmware.com", "controllerKind": "NetworkInfo", "NetworkInfo": {"name":"vmware-system-cert-manager","namespace":"vmware-system-cert-manager"}, "namespace": "vmware-system-cert-manager", "name": "vmware-system-cert-manager", "reconcileID": "2c59a438-0863-4a16-8f18-890e96fa75f0"}
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=0x1ab68c9]

goroutine 471 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
        /Users/wenqiq/GO/src/nsx-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:111 +0x1e5
panic({0x1db3920?, 0x36515d0?})
        /Users/wenqiq/GO/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.5.darwin-amd64/src/runtime/panic.go:770 +0x132
github.com/vmware-tanzu/nsx-operator/pkg/nsx/services/vpc.(*VPCService).EdgeClusterEnabled(0x1d9b880?, 0xc000a88ef0)
        /Users/wenqiq/GO/src/nsx-operator/pkg/nsx/services/vpc/vpc.go:1037 +0x1a9
github.com/vmware-tanzu/nsx-operator/pkg/nsx/services/vpc.(*VPCService).GetLBProvider(0xc000178f50)
        /Users/wenqiq/GO/src/nsx-operator/pkg/nsx/services/vpc/vpc.go:1077 +0x2ad
github.com/vmware-tanzu/nsx-operator/pkg/controllers/networkinfo.(*NetworkInfoReconciler).Reconcile(0xc0004e6080, {0x24e6600, 0xc00086b830}, {{{0xc0009c7be0, 0x1a}, {0xc0009c7bc0, 0x1a}}})
        /Users/wenqiq/GO/src/nsx-operator/pkg/controllers/networkinfo/networkinfo_controller.go:113 +0xff6
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x24eb060?, {0x24e6600?, 0xc00086b830?}, {{{0xc0009c7be0?, 0xb?}, {0xc0009c7bc0?, 0x0?}}})
        /Users/wenqiq/GO/src/nsx-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:114 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0001d1080, {0x24e6638, 0xc0003618b0}, {0x1f27380, 0xc0005d02e0})
        /Users/wenqiq/GO/src/nsx-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:311 +0x3bc
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0001d1080, {0x24e6638, 0xc0003618b0})
        /Users/wenqiq/GO/src/nsx-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:261 +0x1c9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
        /Users/wenqiq/GO/src/nsx-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:222 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 157
        /Users/wenqiq/GO/src/nsx-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:218 +0x486
  1. Update EdgeClusterEnabled function and add a cover unit test case

…eturn values

Signed-off-by: Wenqi Qiu <wenqiq@vmware.com>
Signed-off-by: Wenqi Qiu <wenqiq@vmware.com>
@wenqiq wenqiq changed the title Fixed the nil pointer dereference panic issue when handling the NSX return values Fix the nil pointer dereference panic issue when handling the NSX return values Sep 13, 2024
TaoZou1
TaoZou1 previously approved these changes Sep 13, 2024
pkg/nsx/services/vpc/vpc.go Outdated Show resolved Hide resolved
pkg/nsx/services/vpc/vpc.go Show resolved Hide resolved
pkg/nsx/services/vpc/vpc.go Outdated Show resolved Hide resolved
Change the log level when retrieved the VPC connectivity profile.
@wenqiq
Copy link
Contributor Author

wenqiq commented Sep 18, 2024

/e2e

@timdengyun
Copy link
Contributor

Fix the nil pointer dereference panic issue when handling the NSX return values
-> Title is good to change as
Fix the nil pointer dereference panic issue when checking edge cluster enabled.

I see there are three commits:
seemly, we can squash 6ec223f with first one
or you can squash three commits into one.

@wenqiq
Copy link
Contributor Author

wenqiq commented Sep 19, 2024

Fix the nil pointer dereference panic issue when handling the NSX return values -> Title is good to change as Fix the nil pointer dereference panic issue when checking edge cluster enabled.

I see there are three commits: seemly, we can squash 6ec223f with first one or you can squash three commits into one.

It can be squashed when merging.

@wenqiq wenqiq changed the title Fix the nil pointer dereference panic issue when handling the NSX return values Fix the nil pointer dereference panic issue Sep 19, 2024
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.

5 participants