Skip to content
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

x/debug/cmd/viewcore: panic on reading goroutines #33661

Closed
g7r opened this issue Aug 15, 2019 · 4 comments
Closed

x/debug/cmd/viewcore: panic on reading goroutines #33661

g7r opened this issue Aug 15, 2019 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@g7r
Copy link
Contributor

g7r commented Aug 15, 2019

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

$ go version
go version go1.12.7 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
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/sz/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/sz/go"
GOPROXY=""
GORACE=""
GOROOT="/snap/go/4098"
GOTMPDIR=""
GOTOOLDIR="/snap/go/4098/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-build491690007=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Steps to reproduce:

  1. Run program from https://play.golang.org/p/xmVo_phJxMm
  2. Wait a couple of seconds
  3. Make a core dump of process launched in step 1 (my actions were: sudo gdb --pid=... and then generate-core-file)
  4. viewcore <core-file> --exe <executable-file> overview

I have a ready to use core file but I'm not sure whether it is useful without the executable: https://cloud.mail.ru/public/4Gon/3gDrwK3dW

What did you expect to see?

viewcore shouldn't panic.

What did you see instead?

viewcore panics with:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x739a60]

goroutine 1 [running]:
golang.org/x/debug/internal/core.(*Thread).SP(...)
	/home/sz/src/golang-debug/internal/core/thread.go:32
golang.org/x/debug/internal/gocore.(*Process).readG(0xc0000fe420, 0xc0000fe420, 0xc012192180, 0xc000020640, 0xc012192180)
	/home/sz/src/golang-debug/internal/gocore/process.go:508 +0xab0
golang.org/x/debug/internal/gocore.(*Process).readGs(0xc0000fe420)
	/home/sz/src/golang-debug/internal/gocore/process.go:472 +0x12d
golang.org/x/debug/internal/gocore.Core(0xc000126000, 0xa, 0x0, 0x0)
	/home/sz/src/golang-debug/internal/gocore/process.go:157 +0x2da
main.readCore(0xc000122700, 0xc0000e1d40, 0xc000122700, 0xc0000e1d68)
	/home/sz/src/golang-debug/cmd/viewcore/main.go:260 +0xd5
main.runOverview(0xc4d180, 0xc0000ac400, 0x0, 0x2)
	/home/sz/src/golang-debug/cmd/viewcore/main.go:372 +0x34
github.com/spf13/cobra.(*Command).execute(0xc4d180, 0xc0000ac3a0, 0x2, 0x2, 0xc4d180, 0xc0000ac3a0)
	/home/sz/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:766 +0x2ae
github.com/spf13/cobra.(*Command).ExecuteC(0xc4cf20, 0x8b3323, 0x1, 0xc0000e1f00)
	/home/sz/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2ec
github.com/spf13/cobra.(*Command).Execute(...)
	/home/sz/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800
main.main()
	/home/sz/src/golang-debug/cmd/viewcore/main.go:238 +0x114
@gopherbot gopherbot added this to the Unreleased milestone Aug 15, 2019
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 15, 2019
@andybons
Copy link
Member

@hyangah @randall77

@randall77
Copy link
Contributor

Hmm, something is weird about the core you get from that gdb command.
The core that Go dumps if you send it a SIGABRT with GOTRACEBACK=crash seems fine.
I don't know what the difference is yet. It might take me a few days to investigate further.

@randall77
Copy link
Contributor

Actually, never mind, I can't reproduce this issue. I found a different one...

The cores generated this way are read fine by viewcore for me.

Could you post your binary as well? That would help with debugging.

It looks like somehow there's a goroutine in runnable state, but it has no associated OS thread. That shouldn't happen.

@andybons andybons added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 19, 2019
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Sep 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants