Skip to content
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

time, runtime: zero duration timer takes 2 minutes to fire [1.16 backport] #44869

Closed
gopherbot opened this issue Mar 8, 2021 · 4 comments
Closed

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 8, 2021

@ianlancetaylor requested issue #44868 to be considered for backport to the next 1.16 minor release.

@gopherbot Please open backport to 1.16.

This issue can cause timers to fire up to two minutes late.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Mar 10, 2021

Change https://golang.org/cl/300611 mentions this issue: [release-branch.go1.16] runtime, time: disable preemption in addtimer

@cagedmantis cagedmantis modified the milestones: Go1.16.2, Go1.16.3 Mar 11, 2021
@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented Mar 11, 2021

Marking as a release-blocker for Go 1.16.3: we should consider this backport request and make a decision on it before issuing the next minor release.

@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented Mar 11, 2021

Approving as a serious issue without a workaround. Only Go 1.16 needs this backport.

gopherbot pushed a commit that referenced this issue Mar 12, 2021
The timerpMask optimization updates a mask of Ps (potentially)
containing timers in pidleget / pidleput. For correctness, it depends on
the assumption that new timers can only be added to a P's own heap.

addtimer violates this assumption if it is preempted after computing pp.
That G may then run on a different P, but adding a timer to the original
P's heap.

Avoid this by disabling preemption while pp is in use.

Other uses of doaddtimer should be OK:

* moveTimers: always moves to the current P's heap
* modtimer, cleantimers, addAdjustedTimers, runtimer: does not add net
  new timers to the heap while locked

For #44868
Fixes #44869

Change-Id: I4a5d080865e854931d0a3a09a51ca36879101d72
Reviewed-on: https://go-review.googlesource.com/c/go/+/300610
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
(cherry picked from commit aa26687)
Reviewed-on: https://go-review.googlesource.com/c/go/+/300611
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Mar 12, 2021

Closed by merging 0da04a6 to release-branch.go1.16.

@gopherbot gopherbot closed this Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants