Details
Description
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:
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) } }
Documentation for producer configuration states batch.size=0 as a valid value:
Valid Values: [0,...]
and recommends its use directly:
A small batch size will make batching less common and may reduce throughput (a batch size of zero will disable batching entirely).
Attachments
Issue Links
- duplicates
-
KAFKA-14553 RecordAccumulator hangs in infinite NOP loop
- Resolved
- links to