-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: false positive deadlock when using testing.T.Fatal from goroutine #20908
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
There's no way to prove it's a false positive without full compilable code. Please provide it. Anyway, from guessing what the code may look like, I think it's a quite real deadlock. |
It is not. Reading the docs of IMO it should work like this: |
Show the code. Nothing else matters. |
I think you've misinterpreted the FailNow docs. It ends the goroutine (via calling runtime.Goexit), so if there is stuff happening after that point, it won't run. And if the stuff happening after that is what causes your program to NOT deadlock, then you certainly might have a deadlock. It's not possible for the testing package to guarantee the non-existence of bugs elsewhere in your program. |
I've tweaked the bug's title a bit and I'll also page some runtime and deadlock folks @aclements @dvyukov, s'il vous plait. |
It's not the deadlock detector's responsibility to enforce API constraints. Maybe FailNow should enforce that it's only called from a testing goroutine and give a more useful error if it is not.
It's obviously hard to say without a more complete code example, but this looks like it is an actual concurrency problem and a very real deadlock. I would expect the traceback to point at the Separately, it's an interesting question whether a deadlock should kill the entire test run or just result in a test failure. But the latter would require a fair amount of new runtime API surface that doesn't seem worth its weight. And it would still report it as a deadlock; it would just keep going with the other tests. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?1.8.3
What operating system and processor architecture are you using (
go env
)?Ubuntu 16.04.2
What did you do?
What did you expect to see?
Anything but a false positive with a misleading error message.
What did you see instead?
The text was updated successfully, but these errors were encountered: