Kafka Producer Timeouts
The exception message identifies which timeout boundary expired. Capture it in full with producer metrics and the affected topic-partition.
Classify the Timeout
Section titled “Classify the Timeout”| Message or metric | Investigate |
|---|---|
| Waiting for metadata | DNS, listeners, topic existence, leader, ACLs |
Failed to allocate memory within max.block.ms | Buffer exhaustion or unavailable metadata |
Expiring records after delivery.timeout.ms | Request latency, retries, ISR, throttling |
| Request timeout | Broker queue/processing, replication, network |
High bufferpool-wait-* | Producer throughput exceeds successful delivery |
Cluster Checks
Section titled “Cluster Checks”kafka-cluster.sh api-versions --bootstrap-server kafka:9092kafka-topics.sh --bootstrap-server kafka:9092 \ --describe --topic orderskafka-topics.sh --bootstrap-server kafka:9092 \ --describe --under-min-isr-partitionskafka-configs.sh --bootstrap-server kafka:9092 \ --entity-type topics --entity-name orders --describeCheck client request/error/retry/throttle latency, buffer availability, broker request phases, ISR, leader changes, quotas, and record size.
Unknown Write Outcome
Section titled “Unknown Write Outcome”When a response is lost, the application may not know whether Kafka appended the record. Idempotent producers safely deduplicate retries within the producer session. Non-idempotent applications need a stable event ID and downstream deduplication.
Recover
Section titled “Recover”- Repair connectivity, advertised endpoints, authorization, leader, or replica health.
- Remove a proven quota or capacity bottleneck.
- Align record-size limits across producer, topic/broker, replication, and consumer paths.
- Adjust
delivery.timeout.msonly after measuring the legitimate delivery budget; it must be at leastrequest.timeout.ms + linger.ms.
Do not disable idempotence or reduce acknowledgements to hide an infrastructure failure without accepting the semantic and durability change.
Verify
Section titled “Verify”Confirm records are acknowledged within the normal percentile, error/retry/buffer-wait rates recover, ISR is healthy, and application IDs prove that retries did not create business duplicates.