Skip to content

Fix missing volatile on ShreddedPaperConfiguration.instance#76

Open
mliem2k wants to merge 1 commit into
MultiPaper:ver/26.2from
mliem2k:fix/config-instance-volatile
Open

Fix missing volatile on ShreddedPaperConfiguration.instance#76
mliem2k wants to merge 1 commit into
MultiPaper:ver/26.2from
mliem2k:fix/config-instance-volatile

Conversation

@mliem2k

@mliem2k mliem2k commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Found while investigating #49 (unrelated, reporting separately since it's a distinct bug).

ShreddedPaperConfiguration.instance is a plain static field. get() is read constantly from every region-tick-pool thread; set() is called from whatever thread runs /reload (not a region-tick thread). Without volatile there's no happens-before edge between a write and later reads on other threads, so per the JMM a tick thread is free to keep observing the pre-reload config object indefinitely, including after an operator flips a multithreading/optimizations setting via /reload confirm.

Test plan

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

ShreddedPaperConfiguration.get() is read from every region-tick-pool
thread, but set() is called from whatever thread runs /reload (not a
region-tick thread). Without volatile there is no happens-before edge
between a reload and later reads on other threads, so per the JMM a
tick thread is free to keep observing the pre-reload config object
indefinitely after /reload flips a setting.
Copilot AI review requested due to automatic review settings July 16, 2026 02:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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