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

runtime/cgo: improve sigpanic information #35369

Closed
changkun opened this issue Nov 5, 2019 · 0 comments
Closed

runtime/cgo: improve sigpanic information #35369

changkun opened this issue Nov 5, 2019 · 0 comments

Comments

@changkun
Copy link
Member

changkun commented Nov 5, 2019

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

$ go version
go version go1.13.4 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="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/go/src/github.com/changkun/occamy/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-build636248860=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Developing a cgo program, the information on top of stack trace given by the runtime:

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x7ffb597d8cc0]

runtime stack:
runtime.throw(0xb8a677, 0x2a)
    /usr/local/go/src/runtime/panic.go:774 +0x72
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:378 +0x47c

does not explain why runtime panics the program, no useful information in this stack trace.

By looking at

throw("unexpected signal during runtime execution")
, the thrown information should not just throw a message of unexpected signal during runtime execution.

What did you expect to see?

  1. why runtime panic the program? (e.g. specific information regarding the signal)
  2. who caused it? (more detailed stack trace)

What did you see instead?

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x7ffb597d8cc0]

runtime stack:
runtime.throw(0xb8a677, 0x2a)
    /usr/local/go/src/runtime/panic.go:774 +0x72
runtime.sigpanic()
    /usr/local/go/src/runtime/signal_unix.go:378 +0x47c

goroutine 22 [syscall]:
runtime.cgocall(0x9f6cb0, 0xc00003cde0, 0x0)
    /usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc00003cdb0 sp=0xc00003cd78 pc=0x4050bb
github.com/changkun/occamy/lib._Cfunc_guac_user_handle_connection(0x7ffb4c00e7c0, 0x7ffb00e4e1c0, 0x0)
    _cgo_gotypes.go:399 +0x4d fp=0xc00003cde0 sp=0xc00003cdb0 pc=0x9f011d
github.com/changkun/occamy/lib.(*User).HandleConnection.func1(0xc00000e120, 0x43015a)
    /go/src/github.com/changkun/occamy/lib/user.go:59 +0x66 fp=0xc00003ce20 sp=0xc00003cde0 pc=0x9f1246
github.com/changkun/occamy/lib.(*User).HandleConnection(0xc00000e120, 0xc000106e60, 0x0)
    /go/src/github.com/changkun/occamy/lib/user.go:59 +0x2f fp=0xc00003ce50 sp=0xc00003ce20 pc=0x9f0c6f
github.com/changkun/occamy/server.(*Session).Join.func1(0xc0000f5f80, 0xc, 0x0)
    /go/src/github.com/changkun/occamy/server/session.go:87 +0x2e0 fp=0xc00003cfc8 sp=0xc00003ce50 pc=0x9f5ff0
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc00003cfd0 sp=0xc00003cfc8 pc=0x461041
created by github.com/changkun/occamy/server.(*Session).Join
    /go/src/github.com/changkun/occamy/server/session.go:68 +0x132
@changkun changkun closed this as completed Nov 5, 2019
@golang golang locked and limited conversation to collaborators Nov 4, 2020
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

2 participants