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

http: panic serving <ip>:49540: runtime error: invalid memory address or nil pointer dereference #657

Closed
xh3b4sd opened this issue Mar 29, 2017 · 0 comments
Assignees
Labels

Comments

@xh3b4sd
Copy link

xh3b4sd commented Mar 29, 2017

We are running Flannel 0.6.2 and see this panic. We do not know yet how to reproduce it, but checking the code looks like the fix is quite simple.

Mar 29 14:39:20 0c07434fb78a94a3 flanneld[2655]: http: panic serving <ip>:49540: runtime error: invalid memory address or nil pointer dereference
                                                 goroutine 11673 [running]:
                                                 net/http.(*conn).serve.func1(0xc8203d8180)
                                                         /usr/local/go/src/net/http/server.go:1389 +0xc1
                                                 panic(0xb65400, 0xc820012070)
                                                         /usr/local/go/src/runtime/panic.go:443 +0x4e9
                                                 github.com/coreos/flannel/subnet.nodeToLease(0xc8203e5440, 0x134f7b8, 0x0, 0x0)
                                                         /go/src/github.com/coreos/flannel/subnet/registry.go:400 +0x17c
                                                 github.com/coreos/flannel/subnet.(*etcdSubnetRegistry).getSubnets(0xc8200b7980, 0x7f0653750aa8, 0xc8200dedc0, 0xc82046d9a8, 0x8, 0x0, 0x0, 0x0, 0xc82037e440, 0x0, ...)
                                                         /go/src/github.com/coreos/flannel/subnet/registry.go:142 +0x464
                                                 github.com/coreos/flannel/subnet.(*LocalManager).leasesWatchReset(0xc8200b37c0, 0x7f0653750aa8, 0xc8200dedc0, 0xc82046d9a8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
                                                         /go/src/github.com/coreos/flannel/subnet/local_manager.go:344 +0x119
                                                 github.com/coreos/flannel/subnet.(*LocalManager).WatchLeases(0xc8200b37c0, 0x7f0653750aa8, 0xc8200dedc0, 0xc82046d9a8, 0x8, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
                                                         /go/src/github.com/coreos/flannel/subnet/local_manager.go:276 +0xcd
                                                 github.com/coreos/flannel/remote.handleWatchLeases(0x7f0653750aa8, 0xc8200dedc0, 0x7f06537509e0, 0xc8200b37c0, 0x7f0653793680, 0xc82046c240, 0xc82007a000)
                                                         /go/src/github.com/coreos/flannel/remote/server.go:184 +0x167
                                                 github.com/coreos/flannel/remote.bindHandler.func1(0x7f0653793680, 0xc82046c240, 0xc82007a000)
                                                         /go/src/github.com/coreos/flannel/remote/server.go:291 +0x7a
                                                 net/http.HandlerFunc.ServeHTTP(0xc8201726c0, 0x7f0653793680, 0xc82046c240, 0xc82007a000)
                                                         /usr/local/go/src/net/http/server.go:1618 +0x3a
                                                 github.com/coreos/flannel/vendor/github.com/gorilla/mux.(*Router).ServeHTTP(0xc8200b48c0, 0x7f0653793680, 0xc82046c240, 0xc82007a000)
                                                         /go/src/github.com/coreos/flannel/vendor/github.com/gorilla/mux/mux.go:98 +0x29e
                                                 github.com/coreos/flannel/remote.httpLoggerHandler.ServeHTTP(0x7f0653750cb0, 0xc8200b48c0, 0x7f0653793648, 0xc82006e5b0, 0xc82007a000)
                                                         /go/src/github.com/coreos/flannel/remote/http_logger.go:46 +0xcb
                                                 github.com/coreos/flannel/remote.(*httpLoggerHandler).ServeHTTP(0xc820192020, 0x7f0653793648, 0xc82006e5b0, 0xc82007a000)
                                                         <autogenerated>:48 +0xb6
                                                 net/http.serverHandler.ServeHTTP(0xc8200cb700, 0x7f0653793648, 0xc82006e5b0, 0xc82007a000)
                                                         /usr/local/go/src/net/http/server.go:2081 +0x19e
                                                 net/http.(*conn).serve(0xc8203d8180)
                                                         /usr/local/go/src/net/http/server.go:1472 +0xf2e
                                                 created by net/http.(*Server).Serve
                                                         /usr/local/go/src/net/http/server.go:2137 +0x44e

The panic most likely happens here: https://github.com/coreos/flannel/blob/3b9ac987436d010774ee660929c2b58cd70cd8ab/subnet/registry.go#L400. The address of nil is tried to be accessed, which does not work. See https://play.golang.org/p/7wwMc4VGyJ.

tomdee added a commit to tomdee/flannel that referenced this issue Apr 12, 2017
@tomdee tomdee self-assigned this Apr 12, 2017
tomdee added a commit to tomdee/flannel that referenced this issue Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants