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

   ## What changes were proposed in this pull request?
   **Root Cause**
   The test was failing because of a thread scheduling race condition. Some 
threads could be delayed in starting their execution, and by the time they 
attempted to acquire the lock, the first thread had already completed and reset 
the state from RUNNING back to `IDLE`. This allowed a delayed thread to 
successfully acquire the lock again and call `clearNSSummaryTable()` a second 
time.
   **Changes Made:**
   **Added synchronization barrier (allThreadsStartedLatch):**
   Ensures all 5 threads have started before allowing the first thread to 
complete
   Initialized with `CountDownLatch(threadCount) `to track all threads
   **Modified thread execution:**
   Each thread now counts down allThreadsStartedLatch immediately when it 
starts, before attempting to call reprocess()
   This guarantees the thread is running and will attempt lock acquisition
   **Modified blocking logic:**
   The first thread (that successfully acquires the lock) now waits for 
allThreadsStartedLatch before proceeding
   This ensures all other threads have attempted to acquire the lock and been 
rejected before Thread 1 completes
   **Added proper cleanup:**
   In the finally block, added code to count down any remaining 
allThreadsStartedLatch counts to prevent deadlock in failure scenarios
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-13573
   
   ## How was this patch tested?
   The flaky test is tested by flaky workflow run 2 times with each run 
executed the test 100 times. Here are flaky workflow run pass results:
   https://github.com/devmadhuu/ozone/actions/runs/19853114810
   


-- 
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