Skip to content

Delivery failed after 5 min timeout for certain value sizes #476

Open
@ivonindza

Description

@ivonindza

Description

If the size of the value supplied to producer.produce() falls in the range of [999886-1000033] bytes (inclusive), the delivery will fail with _MSG_TIMED_OUT after 5 minutes (message.timeout.ms). For values with 999885 bytes and less messages are delivered normally, and for those with 1000034 bytes and more produce() returns MSG_SIZE_TOO_LARGE.

Messages stop being sent to the brokers until this 5 minute timeout expires. Producer buffer gets filled however. This problem can also affect a number of messages produced after the one with the "wrong" size, which will also time out.

How to reproduce

import sys
from confluent_kafka import Producer, KafkaException


SIZES = list(range(999886, 1000033+1))

def delivery_callback(err, msg):
    if err is not None:
        print(f'Delivery failed with {err}')

p = Producer({
    'bootstrap.servers': ...,
    'default.topic.config': {'acks': 'all'}
})

size = SIZES[0]
base_size = sys.getsizeof(b'')
val = b'0' * (size - base_size)

try:
    p.produce('test', val, on_delivery=delivery_callback)
except KafkaException as ex:
    print(f'Produce failed with {ex.args[0]}')
finally:
    p.flush()

Checklist

Please provide the following information:

  • confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()): ('0.11.5', 722176), ('0.11.5', 722431)
  • Apache Kafka broker version: 2.11-2.0.0
  • Client configuration: {...}
  • Operating system: linux
  • Provide client logs (with 'debug': '..' as necessary)
  • Provide broker log excerpts
  • Critical issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions