Ask Your Question

Revision history [back]

There are a few things that can be done when multiple Kafka Producers encounter a java.lang.IllegalStateException due to the closing of RecordHeaders:

  1. Retry sending the producerRecord: In some cases, retrying the sending of the same producerRecord can resolve the issue.

  2. Increase the max inflight requests: Increasing the max inflight requests parameter can help avoid record batches getting too large and exceeding the maximum request size.

  3. Use a different partition or topic: If possible, sending the producerRecord to a different partition or topic may avoid the issue.

  4. Check if the Kafka cluster is healthy: If the Kafka cluster is unhealthy, it may cause issues with sending producerRecords. Check if all brokers are online and if there are any issues with replication or partition allocation.

  5. Upgrade the Kafka version: If the issue persists, consider upgrading the Kafka version to the latest stable release. There may be bug fixes or performance improvements that can help resolve the issue.