You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Jun Rao (Jira)" <ji...@apache.org> on 2022/11/28 19:26:00 UTC

[jira] [Resolved] (KAFKA-14303) Producer.send without record key and batch.size=0 goes into infinite loop

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

Jun Rao resolved KAFKA-14303.
-----------------------------
    Fix Version/s: 3.4.0
                   3.3.2
       Resolution: Fixed

Merged the PR to 3.3 and trunk.

> Producer.send without record key and batch.size=0 goes into infinite loop
> -------------------------------------------------------------------------
>
>                 Key: KAFKA-14303
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14303
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients, producer 
>    Affects Versions: 3.3.0, 3.3.1
>            Reporter: Igor Soarez
>            Assignee: Igor Soarez
>            Priority: Major
>              Labels: Partitioner, bug, client, producer, regresion
>             Fix For: 3.4.0, 3.3.2
>
>
> 3.3 has broken previous producer behavior.
> A call to {{producer.send(record)}} with a record without a key and configured with {{batch.size=0}} never returns.
> Reproducer:
> {code:java}
> class ProducerIssueTest extends IntegrationTestHarness {
>   override protected def brokerCount = 1
>   @Test
>   def testProduceWithBatchSizeZeroAndNoRecordKey(): Unit = {
>     val topicName = "foo"
>     createTopic(topicName)
>     val overrides = new Properties
>     overrides.put(ProducerConfig.BATCH_SIZE_CONFIG, 0)
>     val producer = createProducer(keySerializer = new StringSerializer, valueSerializer = new StringSerializer, overrides)
>     val record = new ProducerRecord[String, String](topicName, null, "hello")
>     val future = producer.send(record) // goes into infinite loop here
>     future.get(10, TimeUnit.SECONDS)
>   }
> } {code}
>  
> [Documentation for producer configuration|https://kafka.apache.org/documentation/#producerconfigs_batch.size] states {{batch.size=0}} as a valid value:
> {quote}Valid Values: [0,...]
> {quote}
> and recommends its use directly:
> {quote}A small batch size will make batching less common and may reduce throughput (a batch size of zero will disable batching entirely).
> {quote}



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