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

siddhant pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c4ab8e4cd HDDS-8683. Container balancer thread interrupt may not work 
(#6179)
8c4ab8e4cd is described below

commit 8c4ab8e4cd41f6f03d8032aff72cdaaf0fe1c254
Author: Tejaskriya <[email protected]>
AuthorDate: Wed Feb 28 11:01:17 2024 +0530

    HDDS-8683. Container balancer thread interrupt may not work (#6179)
---
 .../hadoop/hdds/scm/container/balancer/ContainerBalancer.java      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
index 7b5cbe9f21..0e45b13136 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
@@ -342,10 +342,13 @@ public class ContainerBalancer extends StatefulService {
     // NOTE: join should be called outside the lock in hierarchy
     // to avoid locking others waiting
     // wait for balancingThread to die with interrupt
-    balancingThread.interrupt();
     LOG.info("Container Balancer waiting for {} to stop", balancingThread);
     try {
-      balancingThread.join();
+      while (balancingThread.isAlive()) {
+        // retry interrupt every 5ms to avoid waiting when thread is sleeping
+        balancingThread.interrupt();
+        balancingThread.join(5);
+      }
     } catch (InterruptedException exception) {
       Thread.currentThread().interrupt();
     }


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

Reply via email to