mjsax commented on code in PR #18405: URL: https://github.com/apache/kafka/pull/18405#discussion_r1904822413
########## streams/src/test/java/org/apache/kafka/streams/KafkaStreamsTest.java: ########## @@ -982,10 +983,14 @@ public void shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeav closeOptions.timeout(Duration.ZERO); closeOptions.leaveGroup(true); - streams.close(closeOptions); - assertThat(streams.state() == State.PENDING_SHUTDOWN, equalTo(true)); - assertThrows(IllegalStateException.class, streams::cleanUp); - assertThat(streams.state() == State.PENDING_SHUTDOWN, equalTo(true)); + if (streams.close(closeOptions)) { Review Comment: I don't think this fixes the problem. After `streams.close()` returned, and did return `false`, there might be another context switch transiting the state to NOT_RUNNING. We really need to _block_ the `CleanupThread` to make progress. We actually try to do this via `prepareTerminableThread` and let the thread sleep for 2 seconds to block. Seems that is not strong enough. I might be better to actually use an `AtomicBoolean` that would block the `join()` call until we flip it at the end of the test. -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org