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

Handle nil pointer if HNS network not created #82

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

MikeZappa87
Copy link
Contributor

I got the error below and wanted to handle it a little better. It took me awhile to figure out why this was happening. I don't believe the error returned from 'GetNetworkByName' is super user friendly. I can return a useful error message if desired.

Stack trace:

    // time="2022-07-14T03:31:57Z" level=fatal msg="run pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox \"1a690258599b6a720007e10571d4ff5b1c46b03f11d34386a3120dd2af7412ef\": plugin type=\"sdnbridge\" name=\"winl2bridgetest\" failed (add): netplugin failed: \"panic: runtime error: invalid memory address or nil pointer dereference\\n[signal 0xc0000005 code=0x0 addr=0x20 pc=0x8b8975]\\n\\ngoroutine 1 [running]:\\ngithub.com/Microsoft/windows-container-networking/common/core.(*netPlugin).Add(0xc000094900, 0xc00005c150, 0x0, 0x0)\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/common/core/network.go:150 +0x655\\ngithub.com/containernetworking/cni/pkg/skel.(*dispatcher).checkVersionAndCall(0xc00025fe58, 0xc00005c150, 0x9b2440, 0xc000048510, 0xc00025fe40, 0xc000048510)\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/vendor/github.com/containernetworking/cni/pkg/skel/skel.go:166 +0x2c4\\ngithub.com/containernetworking/cni/pkg/skel.(*dispatcher).pluginMain(0xc00025fe58, 0xc00025fe40, 0x0, 0xc00025fe28, 0x9b2440, 0xc000048510, 0x95331c, 0x11, 0xc0001511f0)\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/vendor/github.com/containernetworking/cni/pkg/skel/skel.go:218 +0x428\\ngithub.com/containernetworking/cni/pkg/skel.PluginMainWithError(...)\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/vendor/github.com/containernetworking/cni/pkg/skel/skel.go:275\\ngithub.com/Microsoft/windows-container-networking/cni.(*Plugin).Execute(0xc0000c8050, 0x9b2400, 0xc000094900, 0x0, 0xc0000c8048)\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/cni/plugin.go:49 +0x1f8\\ngithub.com/Microsoft/windows-container-networking/common/core.Core()\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/common/core/core.go:50 +0x2e5\\nmain.main()\\n\\t/home/debjit/goroot/src/github.com/microsoft/windows-container-networking/plugins/sdnbridge/sdnbridge_windows.go:16 +0x27\\n\""

@MikeZappa87 MikeZappa87 marked this pull request as ready for review July 11, 2023 14:11
@debj1t debj1t merged commit baacbec into microsoft:master Sep 13, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants