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

net/http: panic caused by nil dereference looking up route #64839

Closed
mappu opened this issue Dec 21, 2023 · 2 comments
Closed

net/http: panic caused by nil dereference looking up route #64839

mappu opened this issue Dec 21, 2023 · 2 comments

Comments

@mappu
Copy link

mappu commented Dec 21, 2023

Go version

go 1.19.3 linux/amd64

What operating system and processor architecture are you using (go env)?

(No longer available, i'm so sorry)

What did you do?

A user ran a pretty normal Go binary that includes an HTTP server.

After running for ??? time and receiving ??? requests, the Go binary crashed with a panic message.

The user provided the following stack trace, where it seems like a nil http.ResponseWriter / *http.Request were passed to the http.HandleFunc.

What did you expect to see?

Some kind of ordinary error, never a panic -

In fact, it should never be possible for the handler to be called with a nil http.ResponseWriter / *http.Request.

Are there any codepaths that could conceivably lead to this problem?

What did you see instead?

runtime error: invalid memory address or nil pointer dereference
goroutine 9399 [running]:
panic({0x15f0180, 0x243db30})
        /usr/local/go/src/runtime/panic.go:884 +0x212
main.(*Router).Route(0xc0000cf7c0, {0x0, 0x0}, 0x0)
        src/my_app/Router.go:218 +0x7f
net/http.HandlerFunc.ServeHTTP(0x0?, {0x0?, 0xc00064c000?}, 0x496aa5?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x1b0a2d0, 0xc00064c000}, 0xc000646000)
        /usr/local/go/src/net/http/server.go:2487 +0x149
net/http.AllowQuerySemicolons.func1({0x1b0a2d0, 0xc00064c000}, 0xc000646000)
        /usr/local/go/src/net/http/server.go:2974 +0x223
net/http.HandlerFunc.ServeHTTP(0x0?, {0x1b0a2d0?, 0xc00064c000?}, 0x46876e?)
        /usr/local/go/src/net/http/server.go:2109 +0x2f
net/http.serverHandler.ServeHTTP({0xc0001fbef0?}, {0x1b0a2d0, 0xc00064c000}, 0xc000646000)
        /usr/local/go/src/net/http/server.go:2947 +0x30c
net/http.(*conn).serve(0xc0004181e0, {0x1b0db20, 0xc000696db0})
        /usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3102 +0x4db
@mappu
Copy link
Author

mappu commented Dec 21, 2023

The same user is actually reporting various other issues including disk + mmap corruption. So if there is no plausible code path that can lead to a nil w, r passed to a route handler, i am 100% happy to close this off as hardware failure.

EDIT: The customer reported they were running FreeBSD 13.2 with Linux emulation 🤦 So I expect that is where the bug lies.

@seankhliao
Copy link
Member

I'm inclined to close this as a user environment (hardware) issue until we see other reports from more reliable machines.
Note that 1.19 is outside of our supported range.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
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

No branches or pull requests

2 participants