Skip to content

Fix race on bucket random evicion cache - #5189

Merged
SirTyson merged 1 commit into
stellar:masterfrom
SirTyson:bucket-index-race
Apr 9, 2026
Merged

SirTyson merged 1 commit into
stellar:masterfrom
SirTyson:bucket-index-race

Conversation

@SirTyson

@SirTyson SirTyson commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Resolves https://github.com/stellar/stellar-core-internal/issues/492

Originally I was going to create a thread-safe version of the random eviction cache do reduce contention, but until we observe a perf bottleneck related to this cache, just changing the lock to exclusive is the simplest fix.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a concurrency issue in the LiveBucketIndex random-eviction cache by ensuring cache lookups take a write/exclusive lock when they mutate cache-internal state (access counters / generation / last-access).

Changes:

  • Switch cache lookup locking in LiveBucketIndex::getCachedEntry from shared to exclusive to prevent concurrent mutation races.

@SirTyson
SirTyson added this pull request to the merge queue Apr 9, 2026
Merged via the queue into stellar:master with commit 130106d Apr 9, 2026
71 checks passed
@SirTyson
SirTyson deleted the bucket-index-race branch April 9, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants