Skip to content

GoTip: Crash running weblist command from pprof terminal #46709

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

Closed
ardan-bkennedy opened this issue Jun 11, 2021 · 2 comments
Closed

GoTip: Crash running weblist command from pprof terminal #46709

ardan-bkennedy opened this issue Jun 11, 2021 · 2 comments

Comments

@ardan-bkennedy
Copy link

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

$ go version
go version devel go1.17-770f1de8c5 Thu Jun 10 20:20:58 2021 +0000 darwin/amd64

Does this issue reproduce with the latest release?

No, it works fine with 1.16

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/bill/Library/Caches/go-build"
GOENV="/Users/bill/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/bill/code/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/bill/code/go"
GOPRIVATE=""
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.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/bill/code/go/src/github.com/ardanlabs/gotraining/go.mod"
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/6l/gplcbsd16y14gzx7wzyv_dtc0000gn/T/go-build4044938753=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Using this program
https://github.com/ardanlabs/gotraining/blob/master/topics/go/profiling/memcpu/stream.go

I run the following commands.

$ gotip test -bench . -benchtime 3s -benchmem -memprofile p.out

goos: darwin
goarch: amd64
pkg: github.com/ardanlabs/gotraining/topics/go/profiling/memcpu
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
BenchmarkAlgorithmOne-16    	 2680304	      1344 ns/op	      53 B/op	       2 allocs/op
BenchmarkAlgorithmTwo-16    	10274853	       351.8 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/ardanlabs/gotraining/topics/go/profiling/memcpu	9.641s

Then I load the profile into pprof including the test binary.

$ gotip tool pprof memcpu.test p.out

Type: alloc_space
Time: Jun 11, 2021 at 3:41pm (EDT)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof)

Then I run the weblist command.

(pprof) weblist algOne

panic: runtime error: slice bounds out of range [:18446744073692770304] with capacity 931461

goroutine 1 [running]:
cmd/internal/objfile.(*Disasm).Decode(0xc000079a30, 0xc000312070, 0xb, {0x0, 0x1, 0xc000174cb0}, 0xb9, 0x146a400)
	/Users/bill/sdk/gotip/src/cmd/internal/objfile/disasm.go:276 +0x42a
main.(*objTool).Disasm(0x1, {0xc000312070, 0xc000330ed0}, 0xc000330f30, 0xc000174e10, 0xb0)
	/Users/bill/sdk/gotip/src/cmd/pprof/pprof.go:183 +0x9d
cmd/vendor/github.com/google/pprof/driver.(*internalObjTool).Disasm(0xc000308180, {0xc000312070, 0x2}, 0x0, 0xc000348160, 0xe)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/driver/driver.go:273 +0x3b
cmd/vendor/github.com/google/pprof/internal/report.(*sourcePrinter).expandAddresses(0xc00034c0a0, 0xc00030a140, 0x0, 0x0)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/report/source.go:352 +0x376
cmd/vendor/github.com/google/pprof/internal/report.newSourcePrinter(0xc00030a140, {0x15f8238, 0xc000079a40}, {0xc00002e004, 0x52})
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/report/source.go:312 +0x5f7
cmd/vendor/github.com/google/pprof/internal/report.PrintWebList({0x15f13a0, 0xc0003305a0}, 0xc00030a140, {0x15f8238, 0xc000079a40}, 0x8)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/report/source.go:208 +0xcc
cmd/vendor/github.com/google/pprof/internal/report.printWebSource({0x15f13a0, 0xc0003305a0}, 0xc00030c000, {0x15f8238, 0xc000079a40})
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/report/source.go:125 +0x5b
cmd/vendor/github.com/google/pprof/internal/report.Generate({0x15f13a0, 0xc0003305a0}, 0x0, {0x15f8238, 0xc000079a40})
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/report/report.go:115 +0x1c5
cmd/vendor/github.com/google/pprof/internal/driver.generateReport(_, {_, _, _}, {{0x0, 0x0}, 0x0, 0x0, {0x1512b56, 0x7}, ...}, ...)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go:117 +0xd4
cmd/vendor/github.com/google/pprof/internal/driver.interactive(0xc0002b0140, 0xc000034b00)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go:113 +0xa0f
cmd/vendor/github.com/google/pprof/internal/driver.PProf(0xc000034a00)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go:59 +0x149
cmd/vendor/github.com/google/pprof/driver.PProf(0x105fa9b)
	/Users/bill/sdk/gotip/src/cmd/vendor/github.com/google/pprof/driver/driver.go:33 +0x1e
main.main()
	/Users/bill/sdk/gotip/src/cmd/pprof/pprof.go:38 +0xc5

This only happens when the test binary is included when running pprof.

@hyangah
Copy link
Contributor

hyangah commented Jun 11, 2021

Looks like a duplicate of #46636

@ardan-bkennedy
Copy link
Author

Yes, it is. Ok, sorry for the duplicate issue.

@golang golang locked and limited conversation to collaborators Jun 11, 2022
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

3 participants