Skip to content

HDDS-17209. Intermittent failure in TestOMBootstrap#testBootstrapFollower - #11658

Draft
smengcl wants to merge 2 commits into
apache:masterfrom
smengcl:HDDS-17209-flaky
Draft

smengcl wants to merge 2 commits into
apache:masterfrom
smengcl:HDDS-17209-flaky

Conversation

@smengcl

@smengcl smengcl commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

TestOMBootstrap#testBootstrapFollower timed out waiting for Install Checkpoint is finished in the OM log capture, although the follower OM had logged that line 30 seconds before the timeout.

Log4j1Capturer reused the layout instance of the root stdout appender. Log4j 1 PatternLayout is not thread-safe: format() resets and fills a single shared StringBuffer and relies on the owning appender's lock. Since the capture appender and stdout shared one layout, two threads could format into the same buffer at once, so a captured event could be replaced by, or mixed with, another event. The failing run shows the same race on the console, where two events from different threads were garbled into one line.

This affects any test using LogCapturer.captureLogs(...) while other threads log. The fix gives each capturer its own PatternLayout with the same conversion pattern, so each layout is only used under its own appender's lock.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17209

How was this patch tested?

  • Standalone repro (not committed): one thread logs 20000 marker lines to a captured logger while another thread logs to a different logger through stdout. With the original capturer, 58 markers were missing from the capture and text from the other logger leaked into it. With this patch, no markers were missing and nothing leaked.
  • TestOMBootstrap locally: in progress
  • 10x10 flaky-test-check on this branch: in progress

🤖 Generated with Claude Code

…ower

Log4j1Capturer reused the layout instance of the root stdout appender.
Log4j 1 PatternLayout is not thread-safe: format() resets and fills a
single shared StringBuffer and relies on the owning appender's lock. With
the capture appender and the stdout appender sharing one layout, two
threads could format into the same buffer at once, so a captured event
could be replaced by or mixed with another one. TestOMBootstrap then
timed out waiting for "Install Checkpoint is finished" although the OM
had logged it.

Give each capturer its own PatternLayout with the same conversion
pattern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 21, 2026 04:54

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants