Skip to content

x/debug: viewcore tool don't support dumps with go1.13.3+ #38638

Closed
@bozaro

Description

@bozaro

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

$ go version
go version go1.13.2 linux/amd64
go version go1.13.3 linux/amd64
go version go1.14.2 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bozaro/.cache/go-build"
GOENV="/home/bozaro/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB="github.com/joomcode/*"
GOOS="linux"
GOPATH="/home/bozaro/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/bozaro/sdk/go-1.13.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/bozaro/sdk/go-1.13.3/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/bozaro/github/debug/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 -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build072895212=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Make some dumps with steps from https://github.com/golang/debug/blob/master/internal/gocore/testdata/README

With go 1.13.2 it's works as expected:

> go build -o test . && GOTRACEBACK=crash ./test || viewcore core --exe test histogram
[1]    19749 abort (core dumped)  GOTRACEBACK=crash ./test
 count size bytes type
     5  384  1920 runtime.g
     1 1152  1152 [70+2?]string
     1  896   896 runtime.m
     1  480   480 [15]internal/cpu.option
     1  112   112 unk112
     1   96    96 [12]*runtime.p
     1   96    96 hchan<bool>
     1   64    64 runtime.timer
     1   32    32 []*runtime.moduledata
     1   32    32 [4]*runtime.g
     1   16    16 [4]uint32
     1   16    16 string

But with go 1.13.3 I got panic:

[1]    23671 abort (core dumped)  GOTRACEBACK=crash ./test
panic: check failed for heap: 67108864 vs 720896

goroutine 1 [running]:
golang.org/x/debug/internal/gocore.(*Process).readSpans.func2(0xc0006d61e0)
	/home/bozaro/github/debug/internal/gocore/process.go:457 +0x1e3
golang.org/x/debug/internal/gocore.(*Process).readSpans.func2(0xc0006d60f0)
	/home/bozaro/github/debug/internal/gocore/process.go:460 +0x8f
golang.org/x/debug/internal/gocore.(*Process).readSpans(0xc000158000, 0xc000158000, 0x5717c0, 0xc0003b1040, 0xc000791a70, 0x1, 0x1)
	/home/bozaro/github/debug/internal/gocore/process.go:463 +0x1bd0
golang.org/x/debug/internal/gocore.(*Process).readHeap(0xc000158000)
	/home/bozaro/github/debug/internal/gocore/process.go:262 +0x77b
golang.org/x/debug/internal/gocore.Core(0xc00020e000, 0x4, 0x0, 0x0)
	/home/bozaro/github/debug/internal/gocore/process.go:156 +0x2c4
main.readCore(0xc00020a300, 0x8bfb3d, 0x3, 0x0)
	/home/bozaro/github/debug/cmd/viewcore/main.go:265 +0xd2
main.runHistogram(0xc50120, 0xc0001263c0, 0x0, 0x2)
	/home/bozaro/github/debug/cmd/viewcore/main.go:457 +0xdd
github.com/spf13/cobra.(*Command).execute(0xc50120, 0xc000126360, 0x2, 0x2, 0xc50120, 0xc000126360)
	/home/bozaro/go/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0xc4f7a0, 0x8bf822, 0x1, 0xc000207f00)
	/home/bozaro/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ea
github.com/spf13/cobra.(*Command).Execute(...)
	/home/bozaro/go/pkg/mod/github.com/spf13/[email protected]/command.go:800
main.main()
	/home/bozaro/github/debug/cmd/viewcore/main.go:243 +0x104

With go 1.14.2 I got another panic:

[1]    23046 abort (core dumped)  GOTRACEBACK=crash ./test
panic: bad uint8 type runtime.mSpanStateBox

goroutine 1 [running]:
golang.org/x/debug/internal/gocore.region.Uint8(0xc0000be9a0, 0x7fb61e18516b, 0xc000433720, 0x8c019d)
	/home/bozaro/github/debug/internal/gocore/region.go:100 +0xc6
golang.org/x/debug/internal/gocore.(*Process).readSpans(0xc0000be9a0, 0xc0000be9a0, 0x4e7280, 0xc000706550, 0xc000620300, 0x1, 0x1)
	/home/bozaro/github/debug/internal/gocore/process.go:349 +0x566
golang.org/x/debug/internal/gocore.(*Process).readHeap(0xc0000be9a0)
	/home/bozaro/github/debug/internal/gocore/process.go:262 +0x77b
golang.org/x/debug/internal/gocore.Core(0xc0000f2000, 0x4, 0x0, 0x0)
	/home/bozaro/github/debug/internal/gocore/process.go:156 +0x2c4
main.readCore(0xc0000ee300, 0x8bfb3d, 0x3, 0x0)
	/home/bozaro/github/debug/cmd/viewcore/main.go:265 +0xd2
main.runHistogram(0xc50120, 0xc00000e3c0, 0x0, 0x2)
	/home/bozaro/github/debug/cmd/viewcore/main.go:457 +0xdd
github.com/spf13/cobra.(*Command).execute(0xc50120, 0xc00000e360, 0x2, 0x2, 0xc50120, 0xc00000e360)
	/home/bozaro/go/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0xc4f7a0, 0x8bf822, 0x1, 0xc0000ebf00)
	/home/bozaro/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2ea
github.com/spf13/cobra.(*Command).Execute(...)
	/home/bozaro/go/pkg/mod/github.com/spf13/[email protected]/command.go:800
main.main()
	/home/bozaro/github/debug/cmd/viewcore/main.go:243 +0x104

I try update golang.org/x/sys vendor to v0.0.0-20200420163511-1957bb5e6d1f but behavior has not changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions