Kafka Error NETWORK_EXCEPTION
Error code 13 · Retriable Broker
The server disconnected before a response was received.
Common Causes
- Broker closed the connection mid-request due to 'connections.max.idle.ms' timeout (default 10 minutes) while the client was idle
- Load balancer or firewall with a shorter TCP idle timeout than Kafka's 'connections.max.idle.ms', silently killing idle connections
- Broker crash or OOM kill during request processing; client receives TCP RST or connection close before the response
Solutions
- Set TCP keepalive on broker hosts: 'sysctl -w net.ipv4.tcp_keepalive_time=60 net.ipv4.tcp_keepalive_intvl=10 net.ipv4.tcp_keepalive_probes=6' to detect dead connections before the broker closes them
- Align 'connections.max.idle.ms' on the broker with your load balancer/firewall idle timeout; either increase the LB timeout or decrease Kafka's idle timeout
- Producers/consumers should have 'reconnect.backoff.ms' and 'reconnect.backoff.max.ms' configured; the client will auto-reconnect — ensure 'retries' is high enough to survive reconnection time
Diagnostic Commands
# Look for connection/network errors in logs
grep -E 'Disconnected|NetworkException|Connection reset|Broken pipe' /var/log/kafka/server.log | tail -30
# Search logs for related error messages
ss -s && netstat -an | grep -c ESTABLISHED
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.