Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Prevent retry buffer in AsyncProducer to go OOM
This commit adds an optional configuration to Sarama's retry mechanism to limit the size of the retry buffer. The change addresses issues IBM#1358 and IBM#1372 by preventing unbounded memory growth when retries are backlogged or brokers are unresponsive. Key updates: - Added `Producer.Retry.MaxBufferLength` configuration to control the maximum number of messages stored in the retry buffer. - Implemented logic to handle overflow scenarios, ensuring non-flagged messages are either retried or sent to the errors channel, while flagged messages are re-queued. This enhancement provides a safeguard against OOM errors in high-throughput or unstable environments while maintaining backward compatibility (unlimited buffer by default). Signed-off-by: Wenli Wan <[email protected]>
- Loading branch information