You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ch...@apache.org on 2026/09/04 13:57:48 UTC

(hadoop) branch trunk updated: HDFS-17972. TestDFSClientRetries: restore the fault injector and release its latch when the deadlock test dies (#8712)

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

pan3793 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 706d4dcb326 HDFS-17972. TestDFSClientRetries: restore the fault injector and release its latch when the deadlock test dies (#8712)
706d4dcb326 is described below

commit 706d4dcb3266f35fcd5df77add1352a5541d28c4
Author: Jose Luis López López <jo...@gmail.com>
AuthorDate: Fri Sep 4 15:57:40 2026 +0200

    HDFS-17972. TestDFSClientRetries: restore the fault injector and release its latch when the deadlock test dies (#8712)
    
    Authored-by: Jose Luis López López <jo...@gmail.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../java/org/apache/hadoop/hdfs/TestDFSClientRetries.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java
index 8eb2f588228..36dd6c546f1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSClientRetries.java
@@ -1279,12 +1279,15 @@ public void testDFSClientConfigurationLocateFollowingBlock()
   @Timeout(value = 120)
   public void testLeaseRenewAndDFSOutputStreamDeadLock() throws Exception {
     CountDownLatch testLatch = new CountDownLatch(1);
+    DFSClientFaultInjector oldInjector = DFSClientFaultInjector.get();
     DFSClientFaultInjector.set(new DFSClientFaultInjector() {
       public void delayWhenRenewLeaseTimeout() {
         try {
-          testLatch.await();
+          // Bounded, so a stalled out1.close() cannot leave the renewer
+          // holding the LeaseRenewer monitor forever.
+          testLatch.await(30, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
-          e.printStackTrace();
+          Thread.currentThread().interrupt();
         }
       }
     });
@@ -1323,6 +1326,12 @@ public void delayWhenRenewLeaseTimeout() {
       out1.close();
 
     } finally {
+      // Release any lease renewer thread parked in the injector above. If this
+      // test dies before NameNode.complete() runs, the latch is never counted
+      // down by SleepFixedTimeAnswer, and restoring the injector alone does not
+      // free a thread that is already inside the old one.
+      testLatch.countDown();
+      DFSClientFaultInjector.set(oldInjector);
       cluster.shutdown();
     }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org