Skip to content

Fix WorldBorder lock contention in SavedDataStorage - #85

Open
uminezumi wants to merge 1 commit into
MultiPaper:ver/26.3from
uminezumi:fix/worldborder-lock-contention
Open

uminezumi wants to merge 1 commit into
MultiPaper:ver/26.3from
uminezumi:fix/worldborder-lock-contention

Conversation

@uminezumi

@uminezumi uminezumi commented Nov 9, 2026 •

Copy link
Copy Markdown

ServerLevel#getWorldBorder() calls SavedDataStorage#computeIfAbsent on every call, and our thread-safe version of that uses ConcurrentHashMap#compute. compute takes the bin lock even when the value is already there, so region threads end up contending on it whenever they touch the world border.

This checks the cache with a plain get first and only falls back to compute/computeIfAbsent on a miss. Same idea as the get-before-computeIfAbsent in SynchronousPluginExecution.

  • Builds cleanly (./gradlew :shreddedpaper-server:compileJava)

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.

1 participant