From a55dab2ddabb9ee5518f35e2727a6cd5c3562ecd Mon Sep 17 00:00:00 2001 From: dlarge Date: Wed, 2 Oct 2024 12:55:26 +0000 Subject: [PATCH] Don't wait indefinitely for active op count to drain --- .../base/load/step/local/context/LoadStepContextImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/emc/mongoose/base/load/step/local/context/LoadStepContextImpl.java b/src/main/java/com/emc/mongoose/base/load/step/local/context/LoadStepContextImpl.java index b1a4958..b989b06 100644 --- a/src/main/java/com/emc/mongoose/base/load/step/local/context/LoadStepContextImpl.java +++ b/src/main/java/com/emc/mongoose/base/load/step/local/context/LoadStepContextImpl.java @@ -513,13 +513,16 @@ protected final void doShutdown() { @Override protected final void doStop() throws IllegalStateException { if (waitOpFinishBeforeStop) { - while ((activeOpCount() != 0) && !Thread.currentThread().isInterrupted()) { + var i = 0; + var sleep = 1000; + for (; ((activeOpCount() != 0) && !Thread.currentThread().isInterrupted()) && i < 10; i++) { try { - Thread.sleep(1000); + Thread.sleep(sleep); } catch (InterruptedException e) { Loggers.MSG.debug("couldn't put context thread {} to sleep or was interrupted", this); } } + Loggers.MSG.info("{}: waited {}ms for ops to finish (active count = {})", id, i * sleep, activeOpCount()); } driver.stop();