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

plugin: non-deterministic crash on darwin #17836

Closed
wendigo opened this issue Nov 7, 2016 · 7 comments
Closed

plugin: non-deterministic crash on darwin #17836

wendigo opened this issue Nov 7, 2016 · 7 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@wendigo
Copy link

wendigo commented Nov 7, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version devel +e017802 Sun Nov 6 20:11:48 2016 +0000 darwin/amd64

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

GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mateusz.gajewski/Desktop/Projects/"
GORACE=""
GOROOT="/usr/local/Cellar/go/HEAD-e017802/libexec"
GOTOOLDIR="/usr/local/Cellar/go/HEAD-e017802/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/43/1y0rrqr55zq3f8cj5wpkt1kmhc7r33/T/go-build727418654=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

I'm writing generator that wraps plugin with a nice API and getting non-deterministic segmentation faults when I ran it.

Steps to reproduce:

Build plugin.go: https://gist.github.com/wendigo/30147b7009dc42fc3753aa9d2312fbec
Having plugin.so run host.go (generated): https://gist.github.com/wendigo/ac338878b5bb327298b4678584846eae

What did you expect to see?

Once in a while running host.go ends as expected:

&map[]
Hello world!

What did you see instead?

Once in a while running host.go ends with a panic:

&map[]
unexpected fault address 0xb01dfacedebac1e
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x422c139]

goroutine 1 [running]:
runtime.throw(0x42acd29, 0x5)
	/usr/local/Cellar/go/HEAD-e017802/libexec/src/runtime/panic.go:596 +0x95 fp=0xc420051ea0 sp=0xc420051e80
runtime.sigpanic()
	/usr/local/Cellar/go/HEAD-e017802/libexec/src/runtime/signal_unix.go:276 +0x28c fp=0xc420051ef0 sp=0xc420051ea0
main.(*PluginWrapper).PrintHello(0xc420016550, 0x1, 0x1)
	/Users/mateusz.gajewski/Desktop/Projects/src/github.com/wendigo/go-bind-plugin/run.go:58 +0x29 fp=0xc420051f10 sp=0xc420051ef0
main.main()
	/Users/mateusz.gajewski/Desktop/Projects/src/github.com/wendigo/go-bind-plugin/run.go:192 +0xb6 fp=0xc420051f88 sp=0xc420051f10
runtime.main()
	/usr/local/Cellar/go/HEAD-e017802/libexec/src/runtime/proc.go:185 +0x20a fp=0xc420051fe0 sp=0xc420051f88
runtime.goexit()
	/usr/local/Cellar/go/HEAD-e017802/libexec/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc420051fe8 sp=0xc420051fe0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/local/Cellar/go/HEAD-e017802/libexec/src/runtime/asm_amd64.s:2184 +0x1

I've tried to run with GOGC=off - still crashes.

@wendigo
Copy link
Author

wendigo commented Nov 7, 2016

/cc: @crawshaw

@dAdAbird
Copy link
Contributor

dAdAbird commented Nov 7, 2016

Think it's related to #17804

@wendigo
Copy link
Author

wendigo commented Nov 7, 2016

I'm not really sure - it segfaults randomly - not every time.

@quentinmit
Copy link
Contributor

Are you sure this isn't a dupe of #17828?

@wendigo
Copy link
Author

wendigo commented Nov 7, 2016

#17828 crashes always when plugin is loaded
#17836 crashes randomly after plugin was loaded and exported functions are invoked

@quentinmit quentinmit added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 8, 2016
@quentinmit quentinmit added this to the Go1.8 milestone Nov 8, 2016
@crawshaw
Copy link
Member

Do you get these crashes if you put import "C" in your plugin?

@crawshaw
Copy link
Member

Duplicate of #17828.

@golang golang locked and limited conversation to collaborators Nov 12, 2017
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.
Projects
None yet
Development

No branches or pull requests

5 participants