-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Error handler throws an exception on blocking retries #3409
Comments
I didn’t look into code, but if you find it confusing then something is really wrong. We will be happy to review any contribution. Otherwise we will look into this when we can. |
I briefly looked at the issue by running your sample app. It looks like it is doing the right thing, but I agree that something is amiss, as the messages are confusing. The exception is thrown specifically from here: https://github.com/spring-projects/spring-kafka/blob/main/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java#L2719 |
The normal expectation is that when you have enabled retry, you see the exceptions only after all the retries are exhausted and the record fails. So, we will have to debug more and see whats going on. |
@sobychacko Yeah, that is a good point too, to have the error logged only after the attempts are exhausted. Before that I'd prefer to see warnings or infos |
As a workaround, you can set the log level on the error handler to
However, we will introduce a new custom |
@sobychacko, good idea, thank you. I also noticed that for the listeners where I use retry topics along with blocking retries, there is no such a problem. Maybe it will give you some ideas how to fix it for the regular listeners I configure blocking retries for retry topics like this:
|
Fixes: spring-projects#3409 - During error handling, records in retry are throwing `KafkaException` after seeking that causes the exception to get logged which maybe misleading. It seems to indicate that the error handling process itself thew the exception, while the exception was thrown in order to prevent accidental committing of a not-yet recovered record. Change this exception during seeks in retry while handling error from `KafkaException` to a new framework-only used exception - `RecordInRetryException` that simply logs the message at INFO level.
version 3.1.2 - 3.2.2
When using blocking retries an back-off (e.g
new FixedBackOff(5000, 2)
), there is an error message in the log:I see two confusing things here:
Caused by
, the beginning is wrong in my opinion because the Error Handler didn't fail handling my errorsTo reproduce:
Expected behavior
Either no error message at all, or log it right after the attempt fails, before the back-off pause, and with less confusing message
Sample
https://github.com/lm231290/kafka-tests
There is a
retry.log
file there with my execution exampleOr you can run ListenerTest.test_single and see the log messages and the timestamps
The text was updated successfully, but these errors were encountered: