[
https://issues.apache.org/jira/browse/KAFKA-9597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128210#comment-18128210
]
CHIA MIN LIU edited comment on KAFKA-9597 at 10/17/26 4:00 PM:
---------------------------------------------------------------
Hi [~mjsax] , I followed up on the recent failures of
[testInitTransactionTimeout()|https://github.com/apache/kafka/blob/trunk/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java#L1331..L1364]
and reproduced a race locally. Sender can send *InitProducerId* between the
test’s two *{{prepareResponse}}* calls. Its response is then queued for a
future request and can be consumed by a subsequent *FindCoordinator* request,
causing a *ClassCastException* and then a {*}_timeout_{*}. The CI logs don’t
have enough detail to confirm the same cause.
I also considered removing the test, since
[#11452|https://github.com/apache/kafka/pull/11452] added similar coverage.
Those tests retry after initialization has completed; this one can retry while
it’s still pending, though the timing isn’t guaranteed.
Do you think that difference is worth preserving in this test, or is the
existing coverage sufficient?
was (Author: liuliu):
Hi [~mjsax] , I reproduced a race in this test locally: a *FindCoordinator*
request picks up a response meant for {*}InitProducerId{*}, causing a
*ClassCastException* and then a timeout. The CI logs don’t have enough detail
to confirm the same cause.
I also considered removing the test, since
[#11452|https://github.com/apache/kafka/pull/11452] added similar coverage.
Those tests retry after initialization has completed; this one can retry while
it’s still pending, though the timing isn’t guaranteed.
Do you think this test still provides useful coverage beyond the tests added in
[#11452|https://github.com/apache/kafka/pull/11452]?
> Flaky Test KafkaProducerTest#testInitTransactionTimeout
> -------------------------------------------------------
>
> Key: KAFKA-9597
> URL: https://issues.apache.org/jira/browse/KAFKA-9597
> Project: Kafka
> Issue Type: Bug
> Components: clients, producer , unit tests
> Reporter: Matthias J. Sax
> Assignee: CHIA MIN LIU
> Priority: Critical
> Labels: flaky-test
>
> [https://builds.apache.org/job/kafka-pr-jdk11-scala2.13/4866/testReport/junit/org.apache.kafka.clients.producer/KafkaProducerTest/testInitTransactionTimeout/]
> {quote}java.lang.IllegalStateException: No requests pending for inbound
> response FindCoordinatorResponseData(throttleTimeMs=0, errorCode=0,
> errorMessage='NONE', nodeId=0, host='host1', port=1000) at
> org.apache.kafka.clients.MockClient.respond(MockClient.java:345) at
> org.apache.kafka.clients.MockClient.respond(MockClient.java:319) at
> org.apache.kafka.clients.producer.KafkaProducerTest.testInitTransactionTimeout(KafkaProducerTest.java:770){quote}
> STDOUT:
> {quote}[2020-02-22 08:52:04,203] ERROR [Producer clientId=producer-9]
> Uncaught error in kafka producer I/O thread:
> (org.apache.kafka.clients.producer.internals.Sender:241)
> java.lang.IllegalStateException: No previous metadata update to use at
> org.apache.kafka.clients.MockClient$DefaultMockMetadataUpdater.updateWithCurrentMetadata(MockClient.java:623)
> at org.apache.kafka.clients.MockClient.poll(MockClient.java:287) at
> org.apache.kafka.clients.producer.internals.Sender.runOnce(Sender.java:324)
> at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:239) at
> java.base/java.lang.Thread.run(Thread.java:834) [2020-02-22 08:52:04,863]
> ERROR [Producer clientId=producer-10] Interrupted while joining ioThread
> (org.apache.kafka.clients.producer.KafkaProducer:1197)
> java.lang.InterruptedException at java.base/java.lang.Object.wait(Native
> Method) at java.base/java.lang.Thread.join(Thread.java:1313) at
> org.apache.kafka.clients.producer.KafkaProducer.close(KafkaProducer.java:1194)
> at
> org.apache.kafka.clients.producer.KafkaProducer.close(KafkaProducer.java:1171)
> at
> org.apache.kafka.clients.producer.KafkaProducer.close(KafkaProducer.java:1147)
> at
> org.apache.kafka.clients.producer.KafkaProducerTest.lambda$shouldCloseProperlyAndThrowIfInterrupted$1(KafkaProducerTest.java:295)
> at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> at java.base/java.lang.Thread.run(Thread.java:834) [2020-02-22 08:52:05,343]
> ERROR Metadata response reported invalid topics [topic abc]
> (org.apache.kafka.clients.Metadata:295){quote}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)