You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Matthias J. Sax (Jira)" <ji...@apache.org> on 2024/08/23 01:46:00 UTC

[jira] [Resolved] (KAFKA-17371) Flaky test in DefaultTaskExecutorTest.shouldUnassignTaskWhenRequired

     [ https://issues.apache.org/jira/browse/KAFKA-17371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias J. Sax resolved KAFKA-17371.
-------------------------------------
    Fix Version/s: 4.0.0
       Resolution: Fixed

> Flaky test in DefaultTaskExecutorTest.shouldUnassignTaskWhenRequired
> --------------------------------------------------------------------
>
>                 Key: KAFKA-17371
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17371
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Ao Li
>            Assignee: TengYao Chi
>            Priority: Minor
>             Fix For: 4.0.0
>
>
> Please see this fork https://github.com/aoli-al/kafka/tree/KAFKA-251 for a deterministic reproduction.  
> The test failed with 
> {code}
> 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)
> {code}
> 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. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)