net/http/pprof: Index doesn't include Symbol
Go version
go version go1.23.2 linux/amd64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/howard/.cache/go-build'
GOENV='/home/howard/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/howard/go/pkg/mod'
GONOPROXY='[email protected]'
GONOSUMDB='[email protected]'
GOOS='linux'
GOPATH='/home/howard/go'
GOPRIVATE='[email protected]'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/howard/sdk/go1.23.2'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/howard/sdk/go1.23.2/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/howard/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/howard/git/better-strat/go.mod'
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-build2913638291=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Create a minimum http server to serve the default profiling handlers:
package main
import (
"net/http"
_ "net/http/pprof"
)
func main() {
http.ListenAndServe(":8080", http.DefaultServeMux)
}
What did you see happen?
https://pkg.go.dev/net/http/pprof#Index lists all registered profiles, however the output is missing the symbol profile:
<li><div class=profile-name>allocs: </div> A sampling of all past memory allocations</li>
<li><div class=profile-name>block: </div> Stack traces that led to blocking on synchronization primitives</li>
<li><div class=profile-name>cmdline: </div> The command line invocation of the current program</li>
<li><div class=profile-name>goroutine: </div> Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic.</li>
<li><div class=profile-name>heap: </div> A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.</li>
<li><div class=profile-name>mutex: </div> Stack traces of holders of contended mutexes</li>
<li><div class=profile-name>profile: </div> CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile.</li>
<li><div class=profile-name>threadcreate: </div> Stack traces that led to the creation of new OS threads</li>
<li><div class=profile-name>trace: </div> A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.</li>
What did you expect to see?
Either https://pkg.go.dev/net/http/pprof#Index is mistaken and missed the symbol profile, or https://pkg.go.dev/net/http/pprof#Symbol is mistaken and it the package initialisation does not register it at /debug/pprof/symbol.
Related Issues and Documentation
- cmd/pprof: Local symbolization failed for http.test: open /tmp/go-build348974326/b001/http.test: no such file or directory #25743 (closed)
- cmd/trace/v2: pprof profiles always empty #68542 (closed)
- net/http/pprof: Negative allocation counts produced by /debug/pprof/allocs?seconds=1 #49171 (closed)
- cmd/pprof: heap command top and traces show different data #34236 (closed)
- net/http/pprof: URL path /debug/pprof does not list all the available endpoints #24380 (closed)
- cmd/trace: always opening browser, not printing profile #66782 (closed)
- runtime/pprof: WriteHeapProfile example is not strictly equivalent to testing memprofile #65328
- pprof: go tool pprof cannot read the pprof file normally #66227 (closed)
- cmd/pprof: panics if profile is not found #67626 (closed)
- cmd/pprof: panic on debug=0 goroutine profiles #18229 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Change https://go.dev/cl/620455 mentions this issue: net/http/pprof: include Symbol in Index
CC @cherrymui.