This is an automated email from the ASF dual-hosted git repository.

maobaolong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 8aa361683 [#1782] fix: Fix flaky test ShuffleBufferManagerTest (#2100)
8aa361683 is described below

commit 8aa361683ff30e5d6e99d6aedc1bfb5ee506c4b1
Author: maobaolong <[email protected]>
AuthorDate: Sat Jan 4 14:06:32 2025 +0800

    [#1782] fix: Fix flaky test ShuffleBufferManagerTest (#2100)
    
    ### What changes were proposed in this pull request?
    
    As title.
    
    ### Why are the changes needed?
    
    Fix: #1782
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Existing UTs.
---
 .../uniffle/server/buffer/ShuffleBufferManagerTest.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/server/src/test/java/org/apache/uniffle/server/buffer/ShuffleBufferManagerTest.java
 
b/server/src/test/java/org/apache/uniffle/server/buffer/ShuffleBufferManagerTest.java
index 9d9bdd194..4dcb4bb60 100644
--- 
a/server/src/test/java/org/apache/uniffle/server/buffer/ShuffleBufferManagerTest.java
+++ 
b/server/src/test/java/org/apache/uniffle/server/buffer/ShuffleBufferManagerTest.java
@@ -36,6 +36,8 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 import org.roaringbitmap.longlong.Roaring64NavigableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.uniffle.common.PartitionRange;
 import org.apache.uniffle.common.RemoteStorageInfo;
@@ -70,6 +72,8 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 public class ShuffleBufferManagerTest extends BufferTestBase {
+  private static final Logger LOG = 
LoggerFactory.getLogger(ShuffleBufferManagerTest.class);
+
   private ShuffleBufferManager shuffleBufferManager;
   private ShuffleFlushManager mockShuffleFlushManager;
   private ShuffleServer mockShuffleServer;
@@ -656,8 +660,13 @@ public class ShuffleBufferManagerTest extends 
BufferTestBase {
     int retry = 0;
     long committedCount = 0;
     do {
-      committedCount =
-          shuffleFlushManager.getCommittedBlockIds(appId, 
shuffleId).getLongCardinality();
+      try {
+        committedCount =
+            shuffleFlushManager.getCommittedBlockIds(appId, 
shuffleId).getLongCardinality();
+      } catch (Throwable e) {
+        // ignore ArrayIndexOutOfBoundsException and 
ConcurrentModificationException
+        LOG.error("Ignored exception.", e);
+      }
       if (committedCount < expectedBlockNum) {
         Thread.sleep(500);
       }

Reply via email to