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

runtime/pprof Can't find the source files. #29851

Closed
krasi-georgiev opened this Issue Jan 21, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@krasi-georgiev
Copy link

krasi-georgiev commented Jan 21, 2019

Trying to dig into a goroutine profile produced on another machine and list top 10 fails to find the source files.

to reproduce

goroutine.pb.zip

go tool pprof goroutine.pb
(pprof) list top
Total: 164
ROUTINE ======================== github.com/prometheus/prometheus/scrape.(*scrapeLoop).stop in /app/scrape/scrape.go
         0          1 (flat, cum)  0.61% of Total
 Error: open /app/scrape/scrape.go: no such file or directory

I tried with

go tool pprof -symbolize=none prometheus goroutine.pb
go tool pprof --source_path ${GOPATH}/src:${GOROOT}/src prometheus goroutine.pb

but it always tries to find the src files in:
/app/scrape/scrape.go

go version go1.11.4 linux/amd64


GOARCH="amd64"
GOBIN=""
GOCACHE="/home/krasi/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/krasi"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build055364067=/tmp/go-build -gno-record-gcc-switches"
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Jan 21, 2019

Thanks for the bug report. Yes, the compiler records absolute paths for the file names reported in the profile. You can control that by using the compiler's -trimpath option.

If you want to suggest additional ways for the pprof tool to find source files, you should file a bug at https://github.com/google/pprof, which is the master sources for the pprof tool.

I'm going to close this issue because I'm not sure there is anything to do in the Go toolchain.

@krasi-georgiev

This comment has been minimized.

Copy link
Author

krasi-georgiev commented Jan 21, 2019

thanks I solved the problem by creating symlink /app -> to the correct dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment