Navigation Menu

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
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge release-blocker
Milestone

Comments

@gopherbot
Copy link

@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 gopherbot added the CherryPickCandidate Used during the release process for point releases label Mar 8, 2021
@gopherbot gopherbot added this to the Go1.16.1 milestone Mar 8, 2021
@toothrot toothrot modified the milestones: Go1.16.1, Go1.16.2 Mar 10, 2021
@gopherbot
Copy link
Author

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

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

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

@dmitshur dmitshur added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Mar 11, 2021
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

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

@golang golang locked and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants