-
Notifications
You must be signed in to change notification settings - Fork 110
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
fix: make timer operations work with golang 1.23 #667
Conversation
In golang 1.23 reading a timer's channel after calling timer.Stop will block forever. This is fixed by looking at the timer's channel capacity to determine if the channel may need to be read following a Stop.
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #667 +/- ##
==========================================
+ Coverage 60.18% 60.20% +0.01%
==========================================
Files 241 241
Lines 30707 30707
==========================================
+ Hits 18482 18486 +4
+ Misses 10575 10570 -5
- Partials 1650 1651 +1
|
Note: it looks like go is fixing this upstream, so it might not be worth it to add this workaround. |
Even so, clearing the channel is not necessary. The timeout of 1 hour immediately followed by |
Yeah, but I prefer to make code timing independent. Any reason not to just wait for 1.24, then bump the minimum go requirement to 1.23 to completely fix the race? |
@Stebalien I made the code time independent. This PR is still needed since there are places where the timer channel is read following a Stop, and this breaks with go1.23. |
@gammazero golang/go#69312? My understanding is that this is going to be fixed in a patch release very soon. |
Will wait for go fix. Until then, the problem can be avoided by running with |
In golang 1.23 reading a timer's channel after calling timer.Stop will block forever. This is fixed by looking at the timer's channel capacity to determine if the channel may need to be read following a Stop.