diff --git a/engines/python/src/main/java/ai/djl/python/engine/PyProcess.java b/engines/python/src/main/java/ai/djl/python/engine/PyProcess.java index 961ffef66..0cf2bef98 100644 --- a/engines/python/src/main/java/ai/djl/python/engine/PyProcess.java +++ b/engines/python/src/main/java/ai/djl/python/engine/PyProcess.java @@ -205,14 +205,16 @@ synchronized void stopPythonProcess() { void setStarted(boolean started, int id) { if (restartCount.get() == id) { + this.started = started; if (started) { latch.countDown(); - this.started = latch.getCount() == 0; } else { while (latch.getCount() > 0) { latch.countDown(); } } + } else { + logger.warn("Unexpected restartCount: {}, expect: {}", id, restartCount.get()); } }