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: Server.queue nil panic using @master #54478

Closed
elagergren-spideroak opened this issue Aug 16, 2022 · 4 comments
Closed

x/pkgsite: Server.queue nil panic using @master #54478

elagergren-spideroak opened this issue Aug 16, 2022 · 4 comments

Comments

@elagergren-spideroak
Copy link

elagergren-spideroak commented Aug 16, 2022

What version of Go are you using (go version)?

$ go version
go version go1.19 darwin/amd64

Does this issue reproduce with the latest release?

This is the latest release.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/x/gopath/bin"
GOCACHE="/Users/x/Library/Caches/go-build"
GOENV="/Users/x/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/x/gopath/pkg/mod"
GONOPROXY="*.x.com,*.y.com"
GONOSUMDB="*.x.com,*.y.com"
GOOS="darwin"
GOPATH="/Users/x/gopath"
GOPRIVATE="*.x.com,*.x-y.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/x/git/pkgsite/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2b/74fz3jhd4wz4vnbf4z7ywzww0000gp/T/go-build3237606874=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Build the current master (ec5474e46b1e482b25ca9f24e124da8363c5c1f5) with Go 1.19.
  2. Ran pkgsite -list=false inside a local module.
  3. Went to localhost:6060/path/to/module@master

What did you expect to see?

It work.

What did you see instead?

2022/08/16 09:42:30 Info: serveUnitPage: Scheduling "x/y"@"master" to be fetched
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x20c6560]

goroutine 914 [running]:
golang.org/x/pkgsite/internal/frontend.(*Server).serveUnitPage.func1()
	/Users/x/git/pkgsite/internal/frontend/unit.go:160 +0x140
created by golang.org/x/pkgsite/internal/frontend.(*Server).serveUnitPage
	/Users/x/git/pkgsite/internal/frontend/unit.go:156 +0x60c
@adonovan
Copy link
Member

adonovan commented Aug 17, 2022

Thanks for the report. Unfortunately the unit.go source file at ec5474e doesn't line up exactly with the line numbers in the goroutine dump. Indeed, I went back through the history and in fact no commit has a go statement at line 156 or a plausible nil deref at line 160. Did you add any debugging code or otherwise perturb the source?

(I couldn't reproduce the SIGSEGV locally: the request failed, but for a different reason; someone who knows this code base might have better luck.)

@adonovan adonovan added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 17, 2022
@elagergren-spideroak
Copy link
Author

@adonovan yes, I guess I had debugging when I posted the stack trace. The panic is from line 158 (s.queue is nil). Here's a non-modified stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x20c6520]

goroutine 455 [running]:
golang.org/x/pkgsite/internal/frontend.(*Server).serveUnitPage.func1()
	/Users/x/git/pkgsite/internal/frontend/unit.go:158 +0x140
created by golang.org/x/pkgsite/internal/frontend.(*Server).serveUnitPage
	/Users/x/git/pkgsite/internal/frontend/unit.go:154 +0x5cc

@adonovan
Copy link
Member

adonovan commented Aug 17, 2022

Thanks.

The panic is from line 158 (s.queue is nil).

Yes, and it's unclear how it ever worked, since the queue field is never populated, not even conditionally, in this code path. See:

@adonovan adonovan changed the title x/pkgsite: nil pointer panic using @master x/pkgsite: Server.queue nil panic using @master Aug 17, 2022
@seankhliao seankhliao removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 18, 2022
@gopherbot
Copy link

Change https://go.dev/cl/425034 mentions this issue: internal/frontend: serve error on nil queue

@golang golang locked and limited conversation to collaborators Aug 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants