-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: cgo using programs have a goroutine marked [syscall, locked to thread]; make it clearer #16714
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
Comments
Could you please post more about the blocked thread?
e.g. its stack trace.
|
It's here. shiyanhui/dht#6 (comment) |
I don't understand why this goroutine does not show any stack trace. Is there a way that we can recreate the problem ourselves? |
Most programs that import "net" will have this goroutine:
I always assumed it was a cgo finalizer, since the goroutine doesn't appear with |
I tried it with CGO_ENABLED=0 and [syscall, locked to thread] is gone. |
@jbardin Thanks for pointing that out. That explains it. It's not a finalizer goroutine (which indicates its status with "finalizer"). It's a spare goroutine that is created for any Go program that uses cgo in case a thread started by C code calls a Go function. So this is completely normal. I will leave this issue open to make it appear less odd in a stack trace, such as by using a function other than |
CL https://golang.org/cl/45030 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?All tried.
What operating system and processor architecture are you using (
go env
)?What did you do?
DHT implements BitTorrent DHT Protocol. It sends and receives UDP packets.
And you will see it.
What did you expect to see?
Not blocked, maybe [syscall, locked to thread]
What did you see instead?
[syscall, 214 minutes, locked to thread], always blocked. It can be repeatable.
The text was updated successfully, but these errors were encountered: