title: When does the Apache Kafka client throw a "Batch Expired" exception?
body: <p>Using the Apache Kafka Java client (0.9), I'm trying to send a long series of records to the broker using the <a href="https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html">Kafka Producer class</a>. </p>
  
  <p>The asynchronous <a href="https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html#send(org.apache.kafka.clients.producer.ProducerRecord)">send method</a> returns immediately for a while, then starts blocking on each call for a short time period. After around thirty seconds, the client starts throwing exceptions (<a href="https://kafka.apache.org/090/javadoc/org/apache/kafka/common/errors/TimeoutException.html">TimeoutException</a>), with the message <em>"Batch expired"</em>.</p>
  
  <p>What circumstances cause this exception to be thrown? </p>