runtime: bad "deadlock" fatal error when there are pending finalizers #41362
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
This program usually succeeds, but sometimes it fails with "fatal error: all goroutines are asleep - deadlock!":
Adding an extra
runtime.GC()
call makes it reliably* succeed. Removing any makes it reliably* fail. (* Based on 1000 runs.)I think the program should reliably succeed, even if all
runtime.GC()
calls are removed. That is, when the runtime scheduler notices there aren't any runnable goroutines, it should keep running GC cycles until a cycle finishes without running any user finalizers; and only then should it report deadlock if there still aren't any runnable goroutines.I don't know of any real-world programs this affects, so maybe this isn't a high priority if it's difficult to address completely. But it would make writing robust compiler test cases somewhat easier (e.g., see golang.org/cl/254401).
/cc @aclements @ianlancetaylor
The text was updated successfully, but these errors were encountered: