8000 staticlockranking builders failing on release branches on LUCI [1.21 backport] · Issue #64761 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
< 8000 h1 class="gh-header-title mb-2 lh-condensed f1 mr-0 flex-auto wb-break-word"> staticlockranking builders failing on release branches on LUCI [1.21 backport] #64761
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

Closed
gopherbot opened this issue Dec 15, 2023 · 5 comments
Closed
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link
Contributor

@prattmic requested issue #64722 to be considered for backport to the next 1.21 minor release.

@gopherbot please backport to 1.20 and 1.21. This test-only problem is causing failures on the LUCI release branches.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Dec 15, 2023
@gopherbot gopherbot added this to the Go1.21.6 milestone Dec 15, 2023
@dmitshur
Copy link
Member
dmitshur commented Jan 8, 2024

@prattmic Since this backport issue is about fixing a failing builder on release branches, and CL 549536 is reviewed and submitted, is it worth creating the backport CL sooner and checking whether the builder begins to pass? I see there are merge conflicts to resolve.

@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/554976 mentions this issue: [release-branch.go1.21] runtime: properly model rwmutex in lock ranking

@prattmic
Copy link
Member
prattmic commented Jan 9, 2024

@dmitshur Apologies for continuing to not get to this. CLs are sent now!

@dmitshur
Copy link
Member
dmitshur commented Jan 9, 2024

No problem, and thanks!

@gopherbot gopherbot modified the milestones: Go1.21.6, Go1.21.7 Jan 9, 2024
@cherrymui cherrymui added the CherryPickApproved Used during the release process for point releases label Jan 24, 2024
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jan 24, 2024
gopherbot pushed a commit that referenced this issue Jan 25, 2024
(This cherry-pick combines CL 549536 and the follow-up fix CL 555055.)

Currently, lock ranking doesn't really try to model rwmutex. It records
the internal locks rLock and wLock, but in a subpar fashion:

1. wLock is held from lock to unlock, so it works OK, but it conflates
   write locks of all rwmutexes as rwmutexW, rather than allowing
   different rwmutexes to have different rankings.
2. rLock is an internal implementation detail that is only taken when
   there is contention in rlock. As as result, the reader lock path is
   almost never checked.

Add proper modeling. rwmutexR and rwmutexW remain as the ranks of the
internal locks, which have their own ordering. The new init method is
passed the ranks of the higher level lock that this represents, just
like lockInit for mutex.

execW ordered before MALLOC captures the case from #64722. i.e., there
can be allocation between BeforeFork and AfterFork.

For #64722.
Fixes #64761.

------

runtime: replace rwmutexR/W with per-rwmutex lock rank

CL 549536 intended to decouple the internal implementation of rwmutex
from the semantic meaning of an rwmutex read/write lock in the static
lock ranking.

Unfortunately, it was not thought through well enough. The internals
were represented with the rwmutexR and rwmutexW lock ranks. The idea was
that the internal lock ranks need not model the higher-level ordering,
since those have separate rankings. That is incorrect; rwmutexW is held
for the duration of a write lock, so it must be ranked before any lock
taken while any write lock is held, which is precisely what we were
trying to avoid.

This is visible in violations like:

        0 : execW 11 0x0
        1 : rwmutexW 51 0x111d9c8
        2 : fin 30 0x111d3a0
        fatal error: lock ordering problem

execW < fin is modeled, but rwmutexW < fin is missing.

Fix this by eliminating the rwmutexR/W lock ranks shared across
different types of rwmutex. Instead require users to define an
additional "internal" lock rank to represent the implementation details
of rwmutex.rLock. We can avoid an additional "internal" lock rank for
rwmutex.wLock because the existing writeRank has the same semantics for
semantic and internal locking. i.e., writeRank is held for the duration
of a write lock, which is exactly how rwmutex.wLock is used, so we can
use writeRank directly on wLock.

For #64722.

Cq-Include-Trybots: luci.golang.try:go1.21-linux-amd64-staticlockranking
Change-Id: I23335b28faa42fb04f1bc9da02fdf54d1616cd28
Reviewed-on: https://go-review.googlesource.com/c/go/+/549536
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 9b4b3e5)
(cherry picked from commit dcbe772)
Reviewed-on: https://go-review.googlesource.com/c/go/+/554976
@gopherbot
Copy link
Contributor Author

Closed by merging 2f91c16 to release-branch.go1.21.

@golang golang locked and limited conversation to collaborators Jan 24, 2025
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
Projects
None yet
Development

No branches or pull requests

4 participants
0