Suppose we have a kafka producer initialized with default arguments, 60s as max_block_ms and 30s as request_timeout_ms. Then we run a loop:
while True:
producer.send(topic, value)
After we kill all processes in kafka-cluster, I want the producer raise an exception KafkaTimeoutError.
but when max_block_ms > request_timeout_ms, the exception will never be raised out.
Only when max_block_ms < request_timeout_ms, Exception will raised:
KafkaTimeoutError: Failed to allocate memory within the configured max blocking time
My analyse:
when kafka producer try to send, it will block at most request_timeout_ms, after that it will drop those messages and clean send buffer. So, the producer can put new messages into the send buffer. The result is we can't receive any notice but our messages are droped exactly.
So, I think request_timeout_ms should never larger than max_block_ms. What do you think?