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

Crash at runtime/traceback.go:gentraceback #43441

Closed
ghost opened this issue Dec 31, 2020 · 2 comments
Closed

Crash at runtime/traceback.go:gentraceback #43441

ghost opened this issue Dec 31, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Dec 31, 2020

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

$ go version
go version go1.10 linux/amd64

Does this issue reproduce with the latest release?

Cannot reproduce on go1.10, let alone the latest release.

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

Here is the compiling env. Running env is out of reach.

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/opt/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build089432846=/tmp/go-build"

What did you do?

It is a C++ server program, calling a go lib.

What did you expect to see?

Program continues running for a long term.

What did you see instead?

Program crashed after running for several days, with linux log

Dec 20 18:24:03 hostname kernel: myprogram[27064]: segfault at 119 ip 00007f5bb82c8bd2 sp 00007f5bb4840f70 error 4 in libgowrapper.so[7f5bb7fc3000+8e7000]

My analysis

hex(0x7f5bb82c8bd2 - 0x7f5bb7fc3000)= 0x305bd2

(gdb) info sym 0x305bd2
runtime.gentraceback + 5522 in section .text
(gdb) break *0x305bd2  
Breakpoint 1 at 0x305bd2: file /opt/go/src/runtime/traceback.go, line 290.

Link to the line

func gentraceback(...) int {
			flr = findfunc(frame.lr)
			if !flr.valid() {
				// This happens if you get a profiling interrupt at just the wrong time. ...
				doPrint := printing
				if doPrint && gp.m.incgo { // *** Line 290
					// We can inject sigpanic...
					doPrint = false
				}

unsafe.Offsetof(m.incgo) gives 0x119 so the crash point should be exact: m==nil thus accessing m.incgo cause the segfault.

doPrint should be true, so pcbuf == nil && callback == nil is true. gentraceback() should be called for 'stack prints'.

My questiones:

  • How to reproduce 'get a profiling interrupt at just the wrong time'?
  • Is gp.m==nil a go-side problem, or it could be caused by user-side code?
@davecheney
Copy link
Contributor

Go 1.10 is long out of support. I'd strongly suggest upgrading to Go 1.15.6 or the 1.16 beta.

@toothrot
Copy link
Contributor

toothrot commented Jan 5, 2021

Closing, and strongly supporting @davecheney's comment.

Please comment if you can reproduce in a supported version of Go.

@toothrot toothrot closed this as completed Jan 5, 2021
@golang golang locked and limited conversation to collaborators Jan 5, 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