[ 
https://issues.apache.org/jira/browse/KAFKA-18475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18033677#comment-18033677
 ] 

Chang-Yu Huang commented on KAFKA-18475:
----------------------------------------

Hello [~lianetm]. I think the bug comes from a race condition introduced by 
RecordAccumulator#close and RecordAccumulator#batchReady. 
RecordAccumulator#close sets the closed flag to true, and 
RecordAccumulator#batchReady thinks the batch is sendable because of the flag. 
As a result those batches are sent in the same Sender#runOnce call. The 
assertThrows passes because the response has to be polled in the next 
Sender#runOnce call, but Sender#run starts to close after the run that the race 
condition happens.

I will write a unit test to catch this race condition later on. Can I assign 
the ticket to myself if you are not working on it?

> Flaky PlaintextProducerSendTest testCloseWithZeroTimeoutFromCallerThread
> ------------------------------------------------------------------------
>
>                 Key: KAFKA-18475
>                 URL: https://issues.apache.org/jira/browse/KAFKA-18475
>             Project: Kafka
>          Issue Type: Test
>          Components: consumer
>            Reporter: Lianet Magrans
>            Priority: Major
>              Labels: consumer-threading-refactor
>
> Flaky for new consumer only.
> Seems not too flaky, but failed recently in this build:
> [https://github.com/apache/kafka/actions/runs/12712131006/job/35437684253?pr=18050]
>  
> And previously once on trunk
> [https://ge.apache.org/scans/tests?search.buildOutcome=failure&search.names=Git%20branch&search.relativeStartTime=P28D&search.rootProjectNames=kafka&search.timeZoneId=America%2FToronto&search.values=trunk&tests.container=kafka.api.PlaintextProducerSendTest&tests.test=testCloseWithZeroTimeoutFromCallerThread(String%2C%20String)%5B2%5D]
> Fails with :
> h3. testCloseWithZeroTimeoutFromCallerThread(String, 
> String).quorum=kraft.groupProtocol=consumer
> org.opentest4j.AssertionFailedError: Fetch response should have no message 
> returned. ==> expected: <0> but was: <100> at 
> app//kafka.api.BaseProducerSendTest.$anonfun$testCloseWithZeroTimeoutFromCallerThread$1(BaseProducerSendTest.scala:522)
>  at app//scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:190) at 
> app//kafka.api.BaseProducerSendTest.testCloseWithZeroTimeoutFromCallerThread(BaseProducerSendTest.scala:513)
>  



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

Reply via email to