[
https://issues.apache.org/jira/browse/KAFKA-18418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ao Li updated KAFKA-18418:
--------------------------
Description:
KafkaStreams does not synchronize with CloseThread after shutdown thread starts
at line
https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1571
So it is possible for the shutdown helper update the state of the KafkaStreams
(https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1530)
before `waitOnState` is called
(https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1577).
If this happens,
`KafkaStreamsTest::shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse`
will fail.
Trace:
```
Gradle Test Run :streams:test > Gradle Test Executor 7 > KafkaStreamsTest >
shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse()
FAILED
java.lang.AssertionError:
Expected: <true>
but: was <false>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
at
org.apache.kafka.streams.KafkaStreamsTest.shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse(KafkaStreamsTest.java:986)
```
Please check code https://github.com/aoli-al/kafka/tree/KAFKA-159, and run
`./gradlew :streams:test --tests
"org.apache.kafka.streams.KafkaStreamsTest.shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse"`
to reproduce the failure.
was:
KafkaStreams does not synchronize with CloseThread after shutdown thread starts
at line
https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1571
So it is possible for the shutdown helper update the state of the KafkaStreams
(https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1530)
before `waitOnState` is called
(https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1577).
If this happens,
`KafkaStreamsTest::shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse`
will fail.
Please check code https://github.com/aoli-al/kafka/tree/KAFKA-159, and run
`./gradlew :streams:test --tests
"org.apache.kafka.streams.KafkaStreamsTest.shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse"`
to reproduce the failure.
> Flaky test in
> KafkaStreamsTest::shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse
> ---------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-18418
> URL: https://issues.apache.org/jira/browse/KAFKA-18418
> Project: Kafka
> Issue Type: Bug
> Reporter: Ao Li
> Assignee: Ao Li
> Priority: Major
>
> KafkaStreams does not synchronize with CloseThread after shutdown thread
> starts at line
> https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1571
> So it is possible for the shutdown helper update the state of the
> KafkaStreams
> (https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1530)
> before `waitOnState` is called
> (https://github.com/apache/kafka/blob/c1163549081561cade03bbc6a29bfe6caad332a2/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java#L1577).
>
> If this happens,
> `KafkaStreamsTest::shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse`
> will fail.
> Trace:
> ```
> Gradle Test Run :streams:test > Gradle Test Executor 7 > KafkaStreamsTest >
> shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse()
> FAILED
> java.lang.AssertionError:
> Expected: <true>
> but: was <false>
> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
> at
> org.apache.kafka.streams.KafkaStreamsTest.shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse(KafkaStreamsTest.java:986)
> ```
> Please check code https://github.com/aoli-al/kafka/tree/KAFKA-159, and run
> `./gradlew :streams:test --tests
> "org.apache.kafka.streams.KafkaStreamsTest.shouldThrowOnCleanupWhileShuttingDownStreamClosedWithCloseOptionLeaveGroupFalse"`
> to reproduce the failure.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)