Kafka Exception TimeoutException
org.apache.kafka.common.errors.TimeoutException
Retriable
Broker
Indicates that a request timed out.
Common Causes
- Broker overloaded (high CPU, GC pauses, or disk I/O saturation) causing request queue buildup beyond 'request.timeout.ms'
- Network latency or packet loss between client and broker exceeding the client's 'request.timeout.ms' threshold
- Producer with 'acks=all' waiting for ISR acknowledgment but slow replicas or a shrunk ISR delay the response
Solutions
- Increase 'request.timeout.ms' (default 30000ms) and 'delivery.timeout.ms' on producers to give brokers more time under load; for consumers, increase 'request.timeout.ms' and 'default.api.timeout.ms'
- Check broker request handler thread pool: if 'RequestHandlerAvgIdlePercent' JMX metric < 0.3, increase 'num.io.threads' and 'num.network.threads' in broker config
- For ISR-related timeouts: monitor 'IsrShrinksPerSec' and investigate slow replica brokers; check disk throughput with 'iostat -x 1' on broker hosts
Example Stack Trace
org.apache.kafka.common.errors.TimeoutException: The request timed out.Diagnostic Commands
# Check for under-replicated partitions
kafka-topics.sh --describe --bootstrap-server localhost:9092 --under-replicated-partitions
# Check request handler utilization in logs
grep -E 'RequestHandlerAvgIdlePercent|NetworkProcessorAvgIdlePercent' /var/log/kafka/server.log | tail -20Related
Protocol error: REQUEST_TIMED_OUT (code 7)
Related Broker exceptions: CorruptRecordException · FencedLeaderEpochException · LeaderNotAvailableException · NetworkException · NotEnoughReplicasAfterAppendException · NotEnoughReplicasException · NotLeaderOrFollowerException · UnknownLeaderEpochException
Hitting
TimeoutException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.