ableegoldman commented on a change in pull request #9978: URL: https://github.com/apache/kafka/pull/9978#discussion_r566549210
########## File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java ########## @@ -1208,24 +1227,28 @@ private Thread shutdownHelper(final boolean error) { } private boolean close(final long timeoutMs) { - if (state == State.ERROR) { - log.info("Streams client is already in the terminal state ERROR, all resources are closed and the client has stopped."); + if (state == State.ERROR || state == State.NOT_RUNNING) { + log.info("Streams client is already in the terminal {} state, all resources are closed and the client has stopped.", state); return true; } - if (state == State.PENDING_ERROR) { - log.info("Streams client is in PENDING_ERROR, all resources are being closed and the client will be stopped."); - if (waitOnState(State.ERROR, timeoutMs)) { + if (state == State.PENDING_ERROR || state == State.PENDING_SHUTDOWN) { + log.info("Streams client is in {}, all resources are being closed and the client will be stopped.", state); + if (state == State.PENDING_ERROR && waitOnState(State.ERROR, timeoutMs)) { log.info("Streams client stopped to ERROR completely"); return true; + } else if (state == State.PENDING_SHUTDOWN && waitOnState(State.NOT_RUNNING, timeoutMs)) { + log.info("Streams client stopped to NOT_RUNNING completely"); + return true; } else { - log.info("Streams client cannot transition to ERROR completely within the timeout"); + log.warn("Streams client cannot transition to {}} completely within the timeout", state); Review comment: Ah good catch ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org