You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Jason Gustafson (Jira)" <ji...@apache.org> on 2022/06/08 01:54:00 UTC
[jira] [Updated] (KAFKA-13966) Flaky test `QuorumControllerTest.testUnregisterBroker`
[ https://issues.apache.org/jira/browse/KAFKA-13966?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason Gustafson updated KAFKA-13966:
------------------------------------
Description:
We have seen the following assertion failure in `QuorumControllerTest.testUnregisterBroker`:
{code:java}
org.opentest4j.AssertionFailedError: expected: <2> but was: <0>
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:628)
at org.apache.kafka.controller.QuorumControllerTest.testUnregisterBroker(QuorumControllerTest.java:494) {code}
I reproduced it by running the test in a loop. It looks like what happens is that the BrokerRegistration request is able to get interleaved between the leader change event and the write of the bootstrap metadata. Something like this:
# handleLeaderChange() start
# appendWriteEvent(registerBroker)
# appendWriteEvent(bootstrapMetadata)
# handleLeaderChange() finish
# registerBroker() -> writes broker registration to log
# bootstrapMetadata() -> writes bootstrap metadata to log
was:
We have seen the following assertion failure in `QuorumControllerTest.testUnregisterBroker`:
```
org.opentest4j.AssertionFailedError: expected: <2> but was: <0> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55) at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:628) at org.apache.kafka.controller.QuorumControllerTest.testUnregisterBroker(QuorumControllerTest.java:494)
```
I reproduced it by running the test in a loop. It looks like what happens is that the BrokerRegistration request is able to get interleaved between the leader change event and the write of the bootstrap metadata. Something like this:
# handleLeaderChange() start
# appendWriteEvent(registerBroker)
# appendWriteEvent(bootstrapMetadata)
# handleLeaderChange() finish
# registerBroker() -> writes broker registration to log
# bootstrapMetadata() -> writes bootstrap metadata to log
> Flaky test `QuorumControllerTest.testUnregisterBroker`
> ------------------------------------------------------
>
> Key: KAFKA-13966
> URL: https://issues.apache.org/jira/browse/KAFKA-13966
> Project: Kafka
> Issue Type: Bug
> Reporter: Jason Gustafson
> Priority: Major
>
> We have seen the following assertion failure in `QuorumControllerTest.testUnregisterBroker`:
> {code:java}
> org.opentest4j.AssertionFailedError: expected: <2> but was: <0>
> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
> at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
> at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166)
> at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161)
> at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:628)
> at org.apache.kafka.controller.QuorumControllerTest.testUnregisterBroker(QuorumControllerTest.java:494) {code}
> I reproduced it by running the test in a loop. It looks like what happens is that the BrokerRegistration request is able to get interleaved between the leader change event and the write of the bootstrap metadata. Something like this:
> # handleLeaderChange() start
> # appendWriteEvent(registerBroker)
> # appendWriteEvent(bootstrapMetadata)
> # handleLeaderChange() finish
> # registerBroker() -> writes broker registration to log
> # bootstrapMetadata() -> writes bootstrap metadata to log
--
This message was sent by Atlassian Jira
(v8.20.7#820007)