You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by li...@apache.org on 2026/09/22 18:23:30 UTC

(kafka) branch trunk updated: KAFKA-21137: Flaky testSendTxnOffsetsWithGroupIdTransactionV2 (#23539)

This is an automated email from the ASF dual-hosted git repository.

lianetm pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 77483477445 KAFKA-21137: Flaky testSendTxnOffsetsWithGroupIdTransactionV2 (#23539)
77483477445 is described below

commit 77483477445414b00f882ca53de5acacb66857d7
Author: Murali Basani <mu...@aiven.io>
AuthorDate: Tue Sep 22 20:23:21 2026 +0200

    KAFKA-21137: Flaky testSendTxnOffsetsWithGroupIdTransactionV2 (#23539)
    
    The test used `new MockTime(1)`  a clock that jumps 1 ms forward every
    time any thread asks what time it is.  When `sendOffsetsToTransaction`
    waits for a metadata refresh before sending the offsets, because the
    time spent waiting is subtracted from the `max.block.ms` time.  In this
    case,. if sender thread pushes clock past 10s for ex, there is nothing
    left for TxnOffsetCommit itself and the test would fail.
    
    Removed that 1 sec, so using clock that doesn't advance by itself. So ti
    should now cover the timeout.
    
    Test ran 50 times in a loop successfully.
---
 .../java/org/apache/kafka/clients/producer/KafkaProducerTest.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java b/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java
index bac14a59e6a..6180ffee369 100644
--- a/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java
@@ -2013,14 +2013,15 @@ public class KafkaProducerTest {
         properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
         properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
 
-        Time time = new MockTime(1);
+        // No auto-tick: the sender thread would otherwise burn the max.block.ms budget
+        // that sendOffsetsToTransaction shares between the metadata refresh and TxnOffsetCommit.
+        Time time = new MockTime();
         MetadataResponse initialUpdateResponse = RequestTestUtils.metadataUpdateWith(1, singletonMap("topic", 1));
         ProducerMetadata metadata = newMetadata(0, 0, Long.MAX_VALUE);
 
         MockClient client = new MockClient(time, metadata);
         client.updateMetadata(initialUpdateResponse);
 
-        Node node = metadata.fetch().nodes().get(0);
         client.setNodeApiVersions(NodeApiVersions.create());
         NodeApiVersions nodeApiVersions = new NodeApiVersions(NodeApiVersions.create().allSupportedApiVersions().values(),
             Arrays.asList(new ApiVersionsResponseData.SupportedFeatureKey()
@@ -2036,8 +2037,6 @@ public class KafkaProducerTest {
         ApiVersions apiVersions = new ApiVersions();
         apiVersions.update(NODE.idString(), nodeApiVersions);
 
-        client.throttle(node, 5000);
-
         client.prepareResponse(FindCoordinatorResponse.prepareResponse(Errors.NONE, "some.id", NODE));
         client.prepareResponse(initProducerIdResponse(1L, (short) 5, Errors.NONE));
         client.prepareResponse(FindCoordinatorResponse.prepareResponse(Errors.NONE, "some.id", NODE));