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

kvserver: acquire Replica.mu when returning reproposal error #117801

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Jan 16, 2024

Discovered while working on #117612. Looks like it's been there since #42939.

This is a rare error, and these fields are unlikely to change while we're holding the raft mutex, so seems very unlikely to have caused any problems -- I could be convinced we shouldn't backport this, on the off-chance I've missed a potential deadlock.

Epic: none
Release note: None

@erikgrinaker erikgrinaker added the backport-23.2.x Flags PRs that need to be backported to 23.2. label Jan 16, 2024
@erikgrinaker erikgrinaker self-assigned this Jan 16, 2024
@erikgrinaker erikgrinaker requested a review from a team January 16, 2024 10:59
Copy link

blathers-crl bot commented Jan 16, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@erikgrinaker erikgrinaker added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jan 16, 2024
pkg/kv/kvserver/replica_application_result.go Show resolved Hide resolved
@@ -407,6 +407,8 @@ func (r *Replica) tryReproposeWithNewLeaseIndex(ctx context.Context, origCmd *re
// The tracker wants us to forward the request timestamp, but we can't
// do that without re-evaluating, so give up. The error returned here
// will go to back to DistSender, so send something it can digest.
r.mu.RLock()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lock seems legit. At least, the r.mu.proposalBuf access above is assumed without holding the lock (see prpposalBuf comment), and TrackEvaluatingRequest also locks/unlocks the r.mu.RLock().

We're only holding raftMu here (in the weeds of application flow), and it's ok to lock r.mu after it.

@erikgrinaker
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 16, 2024

This PR was included in a batch that timed out, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Jan 16, 2024

Build succeeded:

@craig craig bot merged commit 8daefd5 into cockroachdb:master Jan 16, 2024
8 of 9 checks passed
Copy link

blathers-crl bot commented Jan 16, 2024

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 70bd44d to blathers/backport-release-23.1-117801: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1 backport-23.2.x Flags PRs that need to be backported to 23.2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants