-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: deadlock detection broken with external linking #46260
Comments
It does not reproduce in
|
I can reproduce this on tip for linux/amd64. |
On There is one notable difference, when running This could explain why @jsonbruce couldn't reproduce, can you confirm the exact command you ran? |
Yes, this is known and expected. External linking in general brings in cgo. For a cgo binary even all goroutines are asleep C code can make progress, and we don't know. So we don't signal an error for all goroutines being asleep. That's why runtime deadlock tests require internal linking, e.g. https://tip.golang.org/src/runtime/crash_test.go#L184 . Maybe we could do better detecting just external linking vs. real cgo. Other than that, this is expected. |
At one point there was an accepted proposal for partial deadlock detection (#13759), but it was apparently not implemented. The proposed partial-deadlock detector would be able to diagnose Go deadlocks even in cgo programs. |
See also #29322. Closing this issue because there is nothing new to do here. It's unfortunate but known. In general the deadlock detector is best-effort. I believe that it will also fail in a program that uses the network, even if there are no currently open network connections. |
Thanks for confirming - it makes sense with the external linking/cgo connection.
Heh, the tests in
Right, in this case there is no actual cgo, with all of the threads being Go controlled. Looking at the backtrace I was expecting it to work (and even reading the code and seeing |
Yeah, unfortunately GOROOT/test tests do not have access to internal/testenv, so it has to be done explicitly. |
Change https://golang.org/cl/321450 mentions this issue: |
The following code (based on
test/fixedbugs/issue21576.go
) works as expected when compiled with internal linking, however deadlocks when compiled with external linking:This does not appear to be new (Go 1.15, Go 1.16 and -tip result in the same on initial testing) and impacts multiple platforms (tested on
openbsd/mips64
,openbsd/amd64
,linux/amd64
).The text was updated successfully, but these errors were encountered: