[
https://issues.apache.org/jira/browse/KAFKA-17661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chia-Ping Tsai resolved KAFKA-17661.
------------------------------------
Fix Version/s: 4.0.0
Resolution: Fixed
> Fix flaky BufferPoolTest.testBlockTimeout
> -----------------------------------------
>
> Key: KAFKA-17661
> URL: https://issues.apache.org/jira/browse/KAFKA-17661
> Project: Kafka
> Issue Type: Bug
> Components: clients, unit tests
> Reporter: Yu-Lin Chen
> Assignee: Yu-Lin Chen
> Priority: Major
> Fix For: 4.0.0
>
> Attachments:
> 0001-reproduce-racing-issue-by-adding-delay-to-test-thread.patch
>
>
> 4 flaky out of 221 trunk build in the past 28 days. (github) ([Report
> Link|https://ge.apache.org/scans/tests?search.rootProjectNames=kafka&search.startTimeMax=1727681219558&search.startTimeMin=1725206400000&search.tags=github&search.timeZoneId=Asia%2FTaipei&tests.container=org.apache.kafka.clients.producer.internals.BufferPoolTest&tests.test=testBlockTimeout()])
> ([Sep 27 2024 at
> 04:54:00|https://ge.apache.org/s/nh44u7tsm2lri/tests/task/:clients:test/details/org.apache.kafka.clients.producer.internals.BufferPoolTest/testBlockTimeout()?expanded-stacktrace=WyIwIl0&top-execution=1])
> {code:java}
> org.opentest4j.AssertionFailedError: The buffer allocated more memory than
> its maximum value 10
> at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:38)
> at org.junit.jupiter.api.Assertions.fail(Assertions.java:138)
> at
> org.apache.kafka.clients.producer.internals.BufferPoolTest.testBlockTimeout(BufferPoolTest.java:184)
>
> at java.lang.reflect.Method.invoke(Method.java:566)
> at java.util.ArrayList.forEach(ArrayList.java:1541)
> at java.util.ArrayList.forEach(ArrayList.java:1541)
> {code}
> Root cause:
> # The test relies on 3 asynchronous threads being triggered in parallel with
> the test thread [1]. However, there is no guarantee of parallelism in test
> environment. The issue will happend if test thread didn't get CPU within 25
> ms. We could reproduce this issue by adding 30 ms delay to test thread.
> Please check the attached patch.
> # Since a 25 ms delay is obviously unreliable in the test environment, we
> could consider rewriting the test or increasing the delay. (The
> maxBlockTimeMs was reduced from 2000ms to 10 ms in KAFKA-9852)
> [1]
> [https://github.com/apache/kafka/blob/40360819bb97d6b05dfef6451888b4d908fc3bf4/clients/src/test/java/org/apache/kafka/clients/producer/internals/BufferPoolTest.java#L175-L179]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)