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

x/pkgsite: panic in localdatasource #44704

Closed
gabriel-vasile opened this issue Mar 1, 2021 · 3 comments
Closed

x/pkgsite: panic in localdatasource #44704

gabriel-vasile opened this issue Mar 1, 2021 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. pkgsite

Comments

@gabriel-vasile
Copy link

What did you do?

go run cmd/pkgsite/main.go

Navigated to localhost:8080/net/http. It's not necessarily net/http; any module name that is not like github.com/owner/repo triggers the panic.

What did you expect to see?

This page is not supported by the proxydatasource.

What did you see instead?

panic

2021/03/01 10:27:26 http: panic serving 82.79.132.177:52934: runtime error: invalid memory address or nil pointer dereference
goroutine 296 [running]:
net/http.(*conn).serve.func1(0xc015bb0000)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x12c6580, 0x2d03b70)
/usr/local/go/src/runtime/panic.go:973 +0x396
golang.org/x/pkgsite/internal/localdatasource.(*DataSource).GetUnitMeta(0xc001079cc0, 0x2308140, 0xc015ba85d0, 0xc015bbe025, 0x8, 0x1491599, 0x3, 0x1495f46, 0x6, 0x0, ...)
/tmp/pkgsite/pkgsite/internal/localdatasource/datasource.go:146 +0x310
golang.org/x/pkgsite/internal/frontend.(*Server).serveUnitPage(0xc00004a9c0, 0x2308140, 0xc015ba85d0, 0x22ff500, 0xc015bb2410, 0xc015be8400, 0x230d180, 0xc001079cc0, 0xc015ba8600, 0x0, ...)
/tmp/pkgsite/pkgsite/internal/frontend/unit.go:108 +0x1e4
golang.org/x/pkgsite/internal/frontend.(*Server).serveDetails(0xc00004a9c0, 0x22ff500, 0xc015bb2410, 0xc015be8400, 0x230d180, 0xc001079cc0, 0x0, 0x0)
/tmp/pkgsite/pkgsite/internal/frontend/details.go:65 +0x55d
golang.org/x/pkgsite/internal/frontend.(*Server).errorHandler.func1(0x22ff500, 0xc015bb2410, 0xc015be8400)
/tmp/pkgsite/pkgsite/internal/frontend/server.go:345 +0x9b
net/http.HandlerFunc.ServeHTTP(0xc016b80a80, 0x22ff500, 0xc015bb2410, 0xc015be8400)
/usr/local/go/src/net/http/server.go:2012 +0x44
go.opencensus.io/plugin/ochttp.WithRouteTag.func1(0x22ff500, 0xc015bb2410, 0xc015be8300, 0x1167b05, 0xc015be8300, 0xc016da7948)
/home/gabriel/Code/go/pkg/mod/go.opencensus.io@v0.22.4/plugin/ochttp/route.go:40 +0x201
go.opencensus.io/plugin/ochttp.taggedHandlerFunc.ServeHTTP(0xc015ba8570, 0x22ff500, 0xc015bb2410, 0xc015be8300)
/home/gabriel/Code/go/pkg/mod/go.opencensus.io@v0.22.4/plugin/ochttp/route.go:51 +0x54
golang.org/x/pkgsite/internal/dcensus.(*Router).Handle.func1(0x22ff500, 0xc015bb2410, 0xc015be8300)
/tmp/pkgsite/pkgsite/internal/dcensus/dcensus.go:65 +0xb9
net/http.HandlerFunc.ServeHTTP(0xc016b7b050, 0x22ff500, 0xc015bb2410, 0xc015be8300)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xc016b6e4c0, 0x22ff500, 0xc015bb2410, 0xc015be8300)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
go.opencensus.io/plugin/ochttp.(*Handler).ServeHTTP(0xc016c24050, 0x22ff500, 0xc015bb2410, 0xc015be8100)
/home/gabriel/Code/go/pkg/mod/go.opencensus.io@v0.22.4/plugin/ochttp/server.go:92 +0x27e
golang.org/x/pkgsite/internal/middleware.Timeout.func1.1(0x22fdfc0, 0xc016c82000, 0xc015be8000)
/tmp/pkgsite/pkgsite/internal/middleware/timeout.go:20 +0x16b
net/http.HandlerFunc.ServeHTTP(0xc016b80b80, 0x22fdfc0, 0xc016c82000, 0xc015be8000)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.serverHandler.ServeHTTP(0xc00106c9a0, 0x22fdfc0, 0xc016c82000, 0xc015be8000)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc015bb0000, 0x2308080, 0xc015bc2000)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c

@gopherbot gopherbot added this to the Unreleased milestone Mar 1, 2021
@gabriel-vasile
Copy link
Author

gabriel-vasile commented Mar 1, 2021

If it's ok, I can open a PR to add a check for nil in GetUnitMeta, just like GetUnit has.

@jba
Copy link
Contributor

jba commented Mar 1, 2021

Great, looking forward to it.

@jba jba added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 1, 2021
@jba jba modified the milestones: Unreleased, pkgsite/unplanned Mar 1, 2021
@gopherbot
Copy link

Change https://golang.org/cl/297829 mentions this issue: internal/localdatasource: prevent panic for std modules

gopherbot pushed a commit to golang/pkgsite that referenced this issue Mar 2, 2021
Previously when using the frontend with the local file system data source,
a panic would occur when trying to view docs for stdlib modules. Now the
panic is replaced by returning error 'not found' for missing stdlib
modules.

For golang/go#44704

Change-Id: I584e1663823c494d090237f80878a679ce8ce82f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/297829
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Julie Qiu <julie@golang.org>
Trust: Julie Qiu <julie@golang.org>
@golang golang locked and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. pkgsite
Projects
None yet
Development

No branches or pull requests

3 participants