-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: 1.21 regression in test times with -race
#61852
Comments
Strace: Important part copied here:
|
Duplicate of #61655 |
I'm going to reopen this. It's true that this looks like exactly the same issue as #20364. However, I tested Go releases going back several years and the last major release where I saw the 1s sleep was go 1.13.15. In go 1.14.15 and all later releases I tested before 1.21, there is no sleep. I'm not sure what changed, but the sleep has been gone long enough that I'd say this counts as a regression at this point. I'm guessing it had to do with some race detector change this cycle but I can't locate any relevant issues/discussion with a few searches. The next step is perhaps to bisect so we can locate where it started happening. (I don't have time to do this at the moment but I can take a look later if nobody beats me to it.) |
Just a guess llvm/llvm-project@11081a6. If we hit SKIP_TEST=1 then we exit before we export atexit_sleep_ms=0. Not sure where SKIP_TEST comes from though edit: maybe not, I think that is setting it for the "test" itself |
Actually maybe this: https://reviews.llvm.org/D112603 (llvm/llvm-project@b332134#diff-39729b589bbf9d353b9558f115735f4ec75c3f56539af5d1a2ff1c998d9fb20eR722).
However, I would have thought this meant in 1.20 setting So whatever the case is, it seems more like "atexit_sleep_ms did nothing from Go 1.13 to 1.20, and Go 1.21 fixed it". IMO a default of 0s is ideal, so explicitly setting that to 0 while keeping the fix of cc @dvyukov |
Yes. This was fixed, accidentally, by https://go.dev/cl/486615 for #59711. When using the race detector, when the program calls So for the race detector this is arguably a bug fix. The race detector now honors the So this really is #20364. It's just that the sleep broke when we introduced signal-based preemption, and nobody noticed. Now it is fixed. I don't think there is anything to change in Go, so I'm closing this issue (again). Please comment if you disagree. |
To be honest I think this behavior is not a good default and should be treated as new behavior, even if it was caused by fixing a bug. However that's a personal preference so if the project doesn't agree no problem - easy enough to workaround it in every project I work on. That being said it does seem to warrant a release note on the new behavior and how to disable it? |
@ianlancetaylor - Couple thoughts:
|
The race detector is built on top of Thread Sanitizer, which is what implements |
@mdwhatcott see https://groups.google.com/g/golang-nuts/c/HBJQaijCwGo/m/P1NNQN7wyMAJ |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
Setup mostly empty project:
Now test combinations of
-race
and 1.20 and 1.21:You can see 1.21 +
-race
hangs for exactly 1s after all tests completeThe text was updated successfully, but these errors were encountered: