Skip to content

Commit

Permalink
HDDS-8683. Container balancer thread interrupt may not work (#6179)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejaskriya authored Feb 28, 2024
1 parent e0bf7b4 commit 8c4ab8e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,13 @@ private static void blockTillTaskStop(Thread balancingThread) {
// 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();
}
Expand Down

0 comments on commit 8c4ab8e

Please sign in to comment.