smengcl opened a new pull request, #11658:
URL: https://github.com/apache/ozone/pull/11658

   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](https://github.com/smengcl/hadoop-ozone/actions/runs/39546559884)
 on this branch: in progress
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to