Skip to content

cmd/pprof: panics if profile is not found #67626

@rhysh

Description

@rhysh

Go version

go version devel go1.23-019353d532 Thu May 23 18:51:17 2024 +0000 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/rhysh/.cache/go-build'
GOENV='/home/rhysh/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/rhysh/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/rhysh/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/rhysh/sdk/go-dev'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/rhysh/sdk/go-dev/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-019353d532 Thu May 23 18:51:17 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/rhysh/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3616585202=/tmp/go-build -gno-record-gcc-switches'

What did you do?

$ ./bin/go tool pprof ./missing

What did you see happen?

$ ./bin/go tool pprof ./missing
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x91c737]

goroutine 17 [running]:
cmd/vendor/github.com/google/pprof/internal/driver.fetch({0x7fff1e6ef510, 0x9}, 0xffffffffc4653600, 0xffffffffc4653600, {0x7ff5e88cb1f8, 0xc000080238}, {0xb2eca0, 0xc00009e8a0})
	/home/rhysh/sdk/go-dev/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go:514 +0x2f7
cmd/vendor/github.com/google/pprof/internal/driver.grabProfile(0xc0001ec960, {0x7fff1e6ef510?, 0x9?}, {0x7ff5e88cb1d8?, 0xf1e060?}, {0xb2fc68, 0xc0000331d0}, {0x7ff5e88cb1f8, 0xc000080238}, {0xb2eca0, ...})
	/home/rhysh/sdk/go-dev/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go:334 +0x131
cmd/vendor/github.com/google/pprof/internal/driver.concurrentGrab.func1(0xc000209000)
	/home/rhysh/sdk/go-dev/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go:211 +0x86
created by cmd/vendor/github.com/google/pprof/internal/driver.concurrentGrab in goroutine 7
	/home/rhysh/sdk/go-dev/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go:209 +0x8f

What did you expect to see?

$ ./bin/go tool pprof ./missing
./missing: open ./missing: no such file or directory
failed to fetch any source profiles

Go 1.22 works.

Bisect of this repo says "63dd79c07b0026b58f421a5273c41e705ccb73d1 is the first bad commit". I haven't bisected github.com/google/pprof.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.release-blocker

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions