[ https://issues.apache.org/jira/browse/KAFKA-19091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Uladzislau Blok updated KAFKA-19091: ------------------------------------ Description: The test case is flaky in 3% pipeline recently. The root case is race condition between worker thread (thread which is executing the test) and executor-testDelayedFuture (thread which should execute callback). -Natural fix would be to use CountDownlLatch with timeout to wait until executor-testDelayedFuture will be done with callback, or max waiting time will be reached.- To fix it we can use TestUtils#waitForCondition Error example: {noformat} org.opentest4j.AssertionFailedError: expected: <40> but was: <-1> at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151) at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132) at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:531) at integration.kafka.server.DelayedFutureTest.testDelayedFuture(DelayedFutureTest.scala:91)at java.lang.reflect.Method.invoke(Method.java:580) at java.util.ArrayList.forEach(ArrayList.java:1597) at java.util.ArrayList.forEach(ArrayList.java:1597){noformat} was: The test case is flaky in 3% pipeline recently. The root case is race condition between worker thread (thread which is executing the test) and executor-testDelayedFuture (thread which should execute callback). Natural fix would be to use CountDownlLatch with timeout to wait until executor-testDelayedFuture will be done with callback, or max waiting time will be reached. Error example: {noformat} org.opentest4j.AssertionFailedError: expected: <40> but was: <-1> at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151) at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132) at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150) at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145) at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:531) at integration.kafka.server.DelayedFutureTest.testDelayedFuture(DelayedFutureTest.scala:91)at java.lang.reflect.Method.invoke(Method.java:580) at java.util.ArrayList.forEach(ArrayList.java:1597) at java.util.ArrayList.forEach(ArrayList.java:1597){noformat} > Flaky test DelayedFutureTest#testDelayedFuture > ---------------------------------------------- > > Key: KAFKA-19091 > URL: https://issues.apache.org/jira/browse/KAFKA-19091 > Project: Kafka > Issue Type: Test > Reporter: PoAn Yang > Assignee: Uladzislau Blok > Priority: Minor > > The test case is flaky in 3% pipeline recently. > > The root case is race condition between worker thread (thread which is > executing the test) and executor-testDelayedFuture (thread which should > execute callback). > -Natural fix would be to use CountDownlLatch with timeout to wait until > executor-testDelayedFuture will be done with callback, or max waiting time > will be reached.- > To fix it we can use TestUtils#waitForCondition > > Error example: > {noformat} > org.opentest4j.AssertionFailedError: expected: <40> but was: <-1> > at > org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151) > at > org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132) > at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197) > at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150) > at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145) > at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:531) > at > integration.kafka.server.DelayedFutureTest.testDelayedFuture(DelayedFutureTest.scala:91)at > java.lang.reflect.Method.invoke(Method.java:580) > at java.util.ArrayList.forEach(ArrayList.java:1597) > at java.util.ArrayList.forEach(ArrayList.java:1597){noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)