Skip to content

ZOOKEEPER-5052: Fix stale thread write of primitive in JvmPauseMonitor#2397

Merged
anmolnar merged 1 commit into
apache:masterfrom
PDavid:ZOOKEEPER-5052-JvmPauseMonitor
Jun 16, 2026
Merged

ZOOKEEPER-5052: Fix stale thread write of primitive in JvmPauseMonitor#2397
anmolnar merged 1 commit into
apache:masterfrom
PDavid:ZOOKEEPER-5052-JvmPauseMonitor

Conversation

@PDavid

@PDavid PDavid commented May 27, 2026

Copy link
Copy Markdown
Contributor

Change the three counter fields to volatile to ensure cross-thread visibility when the getters are called from threads other than the monitor thread.

This prevents the JVM caching the stale 0 value. Under CI load or with aggressive JIT optimizations, this manifests as an intermittent 5-second timeout.

Change the three counter fields to volatile to ensure cross-thread visibility when the getters are called from threads other than the monitor thread.

This prevents the JVM caching the stale 0 value. Under CI load or with aggressive JIT optimizations, this manifests as an intermittent 5-second timeout.

@dsmiley dsmiley 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.

+1 Looks like a simple issue; thanks

@imankhadiv imankhadiv 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.

Nice catch!

@anmolnar anmolnar merged commit 9dd41cd into apache:master Jun 16, 2026
16 checks passed
asf-gitbox-commits pushed a commit that referenced this pull request Jun 16, 2026
Reviewers: dsmiley, imankhadiv, anmolnar
Author: PDavid
Closes #2397 from PDavid/ZOOKEEPER-5052-JvmPauseMonitor

(cherry picked from commit 9dd41cd)
Signed-off-by: Andor Molnar <andor@cloudera.com>
@PDavid PDavid deleted the ZOOKEEPER-5052-JvmPauseMonitor branch June 16, 2026 14:29
@PDavid

PDavid commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Many thanks @dsmiley, @imankhadiv and @anmolnar for the reviews!

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.

4 participants