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

cmd/cgo: program got a SIGBUS signal #31593

Closed
duanbing opened this issue Apr 21, 2019 · 6 comments
Closed

cmd/cgo: program got a SIGBUS signal #31593

duanbing opened this issue Apr 21, 2019 · 6 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@duanbing
Copy link

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

$ go version
go version go1.12.4 darwin/amd64

Does this issue reproduce with the latest release?

yes, go version go1.12.4 darwin/amd64 is the latest version I can download.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/duanbing/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/duanbing/Project/Go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/xxxxx/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/35/1f0_9bnn0dvc0mdr0kv8dy08cm5r19/T/go-build681850907=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I write a cgo program, and use go test to run the unit test.
but if I set GOGC=off, go test run as I expect.

What did you expect to see?

tests finished without crash when GOGC=on.

What did you see instead?

I got SIGBUS signal if I just run go test.

@ALTree
Copy link
Member

ALTree commented Apr 21, 2019

Thanks for the report.

It's possible that this is caused by issues with the cgo part of your program. It's possible that the bug is in the C code of your program, and not in the Go runtime.

Can you provide a (possibly small) reproducer? Otherwise it won't be possible to investigate this.

@ALTree ALTree added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 21, 2019
@ALTree ALTree changed the title Cgo program got a SIGBUS signal cmd/cgo: program got a SIGBUS signal Apr 21, 2019
@duanbing
Copy link
Author

Thanks, @ALTree . the codes are too large, so I didn't post it here. I will mimic a simple one to reproduce it. BTW, can you give me some tips about what kinda scenario I will get this error?

@duanbing
Copy link
Author

this is the associated issue, WAVM/WAVM#151 , its maybe helpful.

@duanbing
Copy link
Author

@golang golang deleted a comment Apr 22, 2019
@ALTree
Copy link
Member

ALTree commented Apr 22, 2019

@duanbing Thanks for the investigation.

Unfortunately, as I wrote above, this kind of crashes are often caused by issues in the C code, so I'm afraid this issue won't be actionable from the Go project's side unless you're able to to reduce your large code into a smaller reproducer.

I'll leave this open with a WaitingForInfo label, so feel free to post updates here.

@duanbing
Copy link
Author

duanbing commented Apr 24, 2019

I fixed it by allocating the memory in mmapped section, not in current stack.

Thanks all!

@golang golang locked and limited conversation to collaborators Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants