Copilot commented on code in PR #3776:
URL: https://github.com/apache/celeborn/pull/3776#discussion_r3717695409


##########
client/src/test/java/org/apache/celeborn/client/ShuffleClientSuiteJ.java:
##########
@@ -631,6 +633,53 @@ public void testUpdateReducerFileGroupTimeout() throws 
InterruptedException {
     Assert.assertTrue(exception.getCause() instanceof TimeoutException);
   }
 
+  @Test
+  public void testUpdateReducerFileGroupConcurrentLoadIssuesSingleRpc()
+      throws InterruptedException {
+    // Concurrent first-time loads must dedup to a single GetReducerFileGroup 
RPC (the RPC once
+    // ran under reduceFileGroupsMap's bin lock, convoying every reduce task 
of the shuffle).
+    CelebornConf conf = new CelebornConf();
+    AtomicInteger rpcCount = new AtomicInteger(0);
+    when(endpointRef.askSync(any(), any(), any(Integer.class), 
any(Long.class), any()))
+        .thenAnswer(
+            t -> {
+              rpcCount.incrementAndGet();
+              Thread.sleep(500);
+              return GetReducerFileGroupResponse$.MODULE$.apply(
+                  StatusCode.SUCCESS,
+                  new HashMap<>(),
+                  new int[0],
+                  Collections.emptySet(),
+                  Collections.emptyMap(),
+                  new byte[0],
+                  SerdeVersion.V1);
+            });
+
+    shuffleClient =
+        new ShuffleClientImpl(TEST_APPLICATION_ID, conf, new 
UserIdentifier("mock", "mock"));
+    shuffleClient.setupLifecycleManagerRef(endpointRef);
+
+    int threads = 16;
+    CountDownLatch done = new CountDownLatch(threads);
+    AtomicReference<Exception> failure = new AtomicReference<>();
+    for (int i = 0; i < threads; i++) {
+      new Thread(
+              () -> {
+                try {
+                  shuffleClient.updateFileGroup(0, 0);
+                } catch (Exception e) {
+                  failure.set(e);
+                } finally {
+                  done.countDown();
+                }
+              })
+          .start();
+    }

Review Comment:
   The test spawns raw non-daemon Threads without keeping references. If the 
await/assertion fails (e.g., due to a regression causing deadlock), these 
non-daemon threads can keep the JVM alive and hang the overall test run. 
Consider creating named daemon threads (and optionally preserving only the 
first failure via compareAndSet) to avoid suite hangs and improve diagnostics.



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

Reply via email to