[ https://issues.apache.org/jira/browse/KAFKA-17354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876540#comment-17876540 ]
Ao Li commented on KAFKA-17354: ------------------------------- [~anton.liauchuk] Yes, I'm able to reproduce the failure. Note that you will only see the exception, but the test will still be passed because Junit only marks test failures if there are exceptions from the main thread. I've pushed another commit to the fork https://github.com/aoli-al/kafka/tree/KAFKA-63 to propagate the error to the main thread. If you run `./gradlew streams:test --rerun --tests StreamThreadTest.shouldChangeStateAtStartClos` you will see the test failure. > StreamThread::setState race condition causes java.lang.RuntimeException: > State mismatch PENDING_SHUTDOWN different from STARTING > -------------------------------------------------------------------------------------------------------------------------------- > > Key: KAFKA-17354 > URL: https://issues.apache.org/jira/browse/KAFKA-17354 > Project: Kafka > Issue Type: Bug > Components: streams > Reporter: Ao Li > Assignee: Anton Liauchuk > Priority: Major > > I saw a test failure in `StreamThreadTest::shouldChangeStateAtStartClose`. A > race condition in `setState` causes an uncaught exception thrown in > `StateListenerStub`. > Basically, the function `setState` allows two threads to call > `stateListener.onChange` concurrently. > This patch will help you to reproduce the failure deterministically. > https://github.com/aoli-al/kafka/commit/033a9a33766740e6843effb9beabfdcb3804846b -- This message was sent by Atlassian Jira (v8.20.10#820010)