Repository navigation
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
TestOMBootstrap#testBootstrapFollowertimed out waiting forInstall Checkpoint is finishedin the OM log capture, although the follower OM had logged that line 30 seconds before the timeout.Log4j1Capturerreused the layout instance of the rootstdoutappender. Log4j 1PatternLayoutis not thread-safe:format()resets and fills a single sharedStringBufferand relies on the owning appender's lock. Since the capture appender andstdoutshared 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 ownPatternLayoutwith 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?
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.TestOMBootstraplocally: in progress🤖 Generated with Claude Code