Skip to content

Fix WorldBorder lock contention in SavedDataStorage - #85

Merged
PureGero merged 1 commit into
MultiPaper:ver/26.3from
uminezumi:fix/worldborder-lock-contention
Nov 18, 2026
Merged

PureGero merged 1 commit into
MultiPaper:ver/26.3from
uminezumi:fix/worldborder-lock-contention

Conversation

@uminezumi

@uminezumi uminezumi commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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)

@PureGero
PureGero merged commit e3191fc into MultiPaper:ver/26.3 Nov 18, 2026
@PureGero

Copy link
Copy Markdown
Contributor

Thank you!

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.

2 participants