Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Please see this fork https://github.com/aoli-al/kafka/tree/KAFKA-251 for a deterministic reproduction.
The test failed with
expected: not <null> org.opentest4j.AssertionFailedError: expected: not <null> at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152) at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132) at org.junit.jupiter.api.AssertNotNull.failNull(AssertNotNull.java:49) at org.junit.jupiter.api.AssertNotNull.assertNotNull(AssertNotNull.java:35) at org.junit.jupiter.api.AssertNotNull.assertNotNull(AssertNotNull.java:30) at org.junit.jupiter.api.Assertions.assertNotNull(Assertions.java:304) at org.apache.kafka.streams.processor.internals.tasks.DefaultTaskExecutorTest.shouldUnassignTaskWhenRequired(DefaultTaskExecutorTest.java:233) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
The root cause of the failure is that `currentTask = taskManager.assignNextTask(DefaultTaskExecutor.this);` is not an atomic operation. This means that calling `taskManager.assignNextTask` will unblock the `verify(taskManager, timeout(VERIFICATION_TIMEOUT)).assignNextTask(taskExecutor);` statement in the test method.
If `assertNotNull(taskExecutor.currentTask());` is executed before the assignment `currentTaks = [...]` the test will fail.
Attachments
Issue Links
- is related to
-
KAFKA-17394 Flaky test in DefaultTaskExecutorTest.shouldSetUncaughtStreamsException
-
- Open
-
- links to