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 using programs have a goroutine marked [syscall, locked to thread]; #17384

Closed
vcaesar opened this issue Oct 8, 2016 · 4 comments

Comments

@vcaesar
Copy link

vcaesar commented Oct 8, 2016

Please answer these questions before submitting your issue. Thanks!

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

go1.7.1

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

no problem

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

Ubuntu and Windows is ok, but mac os 10.12 have error; C func is tested,no error

What did you see instead?

error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7fff823874cc]

runtime stack:
runtime.throw(0x40ac919, 0x2a)
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x407fb20, 0xc420049e60, 0x0)
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/cgocall.go:131 +0x110 fp=0xc420049e30 sp=0xc420049df0
robotgo._Cfunc_akeyTap(0x46001c0, 0x4600000, 0x0)
??:0 +0x4e fp=0xc420049e60 sp=0xc420049e30
robotgo.AKeyTap(0x40a76c5, 0x1, 0x40a7a6c, 0x7)
/Users/xxx/go/gopath/src/robotgo/robotgo.go:144 +0x73 fp=0xc420049eb8 sp=0xc420049e60
main.arobotgo()
/Users/xxx/go/gopath/src/robotgo/test/main.go:24 +0x64 fp=0xc420049ee8 sp=0xc420049eb8
main.main()
/Users/xxx/go/gopath/src/robotgo/test/main.go:34 +0x26 fp=0xc420049f48 sp=0xc420049ee8
runtime.main()
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/proc.go:183 +0x1f4 fp=0xc420049fa0 sp=0xc420049f48
runtime.goexit()
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420049fa8 sp=0xc420049fa0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/Cellar/go/1.7.1/libexec/src/runtime/asm_amd64.s:2086 +0x1
exit status 2

@ianlancetaylor
Copy link
Contributor

This is what you will see if the C code you are calling dereferences a NULL pointer at PC 0x7fff823874cc. Use the debugger to find the function at that address. The "syscall, locked to thread" is normal for a signal that occurs during a cgo call. Closing because there is no obvious Go problem. The fact that it works on other systems does not mean that it works on Mac OS. If you are convinced there is a Go problem, please tell us precisely how we can reproduce the problem ourselves.

@vcaesar
Copy link
Author

vcaesar commented Oct 13, 2016

The input method caused this error, some input method can't get.

@nicerobot
Copy link

I'm not certain this is the same issue but I can reproduce the segv at src/runtime/cgocall.go:131 using the paulsmith/gogeos library.

@ianlancetaylor
Copy link
Contributor

@nicerobot This issue is closed. Please open a new issue with your problem. Thanks.

At a quick glance the paulsmith/gogeos package looks risky, as it uses runtime.SetFinalizer but never uses runtime.KeepAlive. See https://golang.org/doc/go1.8#liveness .

@golang golang locked and limited conversation to collaborators Jul 16, 2018
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

4 participants