Repository navigation
testing: Cleanup races with Logf and Errorf #40908
Description
Activity
- addedNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Aug 19, 2020 Looks like https://go-review.googlesource.com/c/go/+/232237 introduced this issue FWIW.
Reacted by Bryan C. Mills@bcmills Indeed, thanks for pointing this out. I'll work on a fix.
Reacted by Bryan C. Mills and Tobias KlauserWe also ran into this here: knative/serving#9153 when I switched from defer to t.Cleanup.
Change https://golang.org/cl/250078 mentions this issue:
testing: fix Cleanup race with Logf and Errorf@gopherbot, please backport to 1.15. This is a fairly subtle race condition, and the fix is small and contained.
Backport issue(s) opened: #41034 (for 1.15).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.
Go 1.14.7 does not seem to be affected, so no backport to 1.14 is needed.
Reacted by Dmitri ShuralyovChange https://golang.org/cl/250617 mentions this issue:
[release-branch.go1.15] testing: fix Cleanup race with Logf and Errorf- added a commit that references this issue
on Aug 27, 2020 - addedNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.and removedNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Sep 2, 2020 - locked and limited conversation to collaborators
on Sep 2, 2021 - added a commit that references this issue
on Apr 29, 2024
The program in https://play.golang.org/p/rV-CkJivlXs fails under
go test -race:I think this race should be fixed, because this usage seems reasonable to me: for example, calling
t.Logfdirectly from theCleanupcallback does not race, and it seems very odd to allowt.Logfbefore and after cleanup begins but not during.CC @rogpeppe @ianlancetaylor @bradfitz