Skip to content

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

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:repropose-error-mutex
Jan 16, 2024
Merged

kvserver: acquire Replica.mu when returning reproposal error#117801
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:repropose-error-mutex

Conversation

@erikgrinaker
Copy link
Copy Markdown
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 PAST MAINTENANCE SUPPORT: 23.2 patch releases via ER request only label Jan 16, 2024
@erikgrinaker erikgrinaker requested a review from pav-kv January 16, 2024 10:59
@erikgrinaker erikgrinaker self-assigned this Jan 16, 2024
@erikgrinaker erikgrinaker requested a review from a team January 16, 2024 10:59
@blathers-crl
Copy link
Copy Markdown

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
Copy Markdown
Member

This change is Reviewable

@erikgrinaker erikgrinaker added the backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only label Jan 16, 2024
// 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
Copy Markdown
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 erikgrinaker force-pushed the repropose-error-mutex branch from c5dab33 to 70bd44d Compare January 16, 2024 15:37
@erikgrinaker
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
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
Copy Markdown
Contributor

craig bot commented Jan 16, 2024

Build succeeded:

@blathers-crl
Copy link
Copy Markdown

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 PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only backport-23.2.x PAST MAINTENANCE SUPPORT: 23.2 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants