Why is the ProducerFencedException not retried? #3985
Replies: 1 comment 1 reply
-
Have you tried increasing your transaction timeout - both on the Spring side and on the kafka broker? The fact that smaller chunks work means that something might be slowing things down on the app side, maybe you want to debug things there. In terms of the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am working on a Spring Boot application integrated with Kafka (consuming, processing, and producing), which uses transactions.
After refactoring, we started experiencing ProducerFencedExceptions, which I believe are related to transaction timeouts. The Kafka log looks like this:
Breaking into smaller batches seems to solve the problem. However, we've noticed that whenever a ProducerFencedException occurs, the produced events are uncommitted (as expected), but the retry configuration (@RetryableTopic) is ignored, so the events do not land on the DLQ.
According to the Spring docs (https://docs.spring.io/spring-kafka/reference/kafka/annotation-error-handling.html#default-eh), the DefaultErrorHandler considers certain exceptions to be fatal and skips retries for such exceptions. However, ProducerFencedException is not listed.
It seems to me that the ProducerFencedException is treated as a "container-level" fatal exception. I am looking for further information and best practices to handle such errors properly in the future.
The listener ack-mode is manual_immediate.
Beta Was this translation helpful? Give feedback.
All reactions