-
Notifications
You must be signed in to change notification settings - Fork 1.6k
RetryableTopic - breaking changes in the error handler #2184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A slight clarification regarding the back off exception handler changes. The passed Lines 176 to 179 in 93efeb4
The |
Hi @v-chernyshev, thanks for reporting this.
I don't see this behavior in my tests. Since all classifications now return
This one I can reproduce. The idea is that |
Also, the previous |
Just for clarification, the exception isn't unwrapped here, it's just thrown again. |
Yes, you are absolutely right, I didn't phrase myself properly.
All right, I'll try to come up with an example based on our code, hopefully by the end of tomorrow. Thanks for looking into it! |
@v-chernyshev ok, thanks. I'll keep looking for the behavior you described. Can you just please check if by any chance you're adding exceptions to the |
Yes, your guess is correct. In my tests I added all the default exceptions back via |
We have this logic in Lines 145 to 152 in 1d13671
Since the classification returns false, it should go to the else branch which has no sleep, which is what happens on my tests. Looks right? |
Yes, with an empty classifier it indeed always goes into the else branch. Unfortunately, the only way that I could find to avoid getting the back off exception logs at error level with version 2.8.4 was to redirect the code flow to Admittedly, I do not really know how the return value of |
Ok, so just to make sure we're on the same page. Functionality-wise the framework is behaving as expected - it only retries when it should. The problem at hand is that Does that sound about right? |
We've documented the changes here |
Thanks for the link, somehow I've missed this section. And yes, all of it started with the back off exceptions showing up in the logs, which is the only issue. Everything else is due to my misunderstanding of the changes, sorry for the confusion. |
No problem, I totally understand that starting to see It was really good that you brought this up early - now we had a chance to double check the behavior and see that the changes we made are ok functionality-wise, and can also start looking for a workaround and fix for the logs. So thanks a lot for that. Specially because, well, if that's really the case, people should be seeing these logs everywhere, so I expect to see this issue popping around again here and on StackOverflow. It also occurred to me that the |
One unexpected side effect though is that |
As for the workaround, this one based on what you suggested worked out for me:
|
@v-chernyshev, I opened a PR with a fix for the log issue, if you're able to take a look it'd be great. It's a simple one but those are the worst 😄 I'm not sure Thanks |
@garyrussell @tomazfernandes I'm afraid that this problem has started happening again in version 2.9.0 with seeks after error set to false. A Lines 74 to 83 in 51db0b6
Is then wrapped in a Lines 2395 to 2397 in 51db0b6
Then it reaches this error handler: Lines 2694 to 2697 in 51db0b6
Which calls Lines 2825 to 2827 in 51db0b6
This method is defined here: spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/listener/DefaultErrorHandler.java Lines 152 to 163 in 51db0b6
The exception, quite rightfully, cannot be recovered, so |
Please let me know if I should submit a separate issue with these details. |
Please open a new issue; this is not a regression but a problem with the new feature. We hoped that folks would try it out via the milestones/release candidate before it was formally released. Thanks. |
Thank you for the prompt reply.
Unfortunately, I have just found a bit of spare time to update the dependencies of the service that uses this feature 😞 I'll send new issues with the feedback based on my testing of version 2.9.0. |
Resolves spring-projects#2184 `KafkaBackOffException`s are incorrectly logged at ERROR level during retries when using the no-seek error handling mode. They are not logged in the seek mode; see spring-projects@448871a **cherry-pick to 2.9.x**
In what version(s) of Spring for Apache Kafka are you seeing this issue?
2.8.4.
Describe the bug
ListenerContainerFactoryConfigurer
now creates its error handler here:spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryConfigurer.java
Lines 235 to 246 in 93efeb4
There are two breaking changes/regressions compared to version 2.8.3:
createDefaultErrorHandlerInstance
no longer provides a "no retry" back off strategy by default. The outcome of this change is that a to-be-recovered record is retried 10 times instead of immediately being sent into the next recovery topic.errorHandler.defaultFalse
completely disables the default classification of the fatal exceptions (such asDeserializationException.class
). In fact, every classification request now returnsfalse
.The second change causes every back off exception to be printed at error level due to the code here:
spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/listener/FailedRecordProcessor.java
Lines 143 to 164 in f0ad7b0
getClassifier().classify(thrownException)
now always returns false andthis.failureTracker.getRecoverer().accept
may throw a back off exception, which does not reach the following special back off exception handler any longer:spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/listener/SeekUtils.java
Lines 109 to 113 in 93efeb4
To Reproduce
Unfortunately, I do not have a sample right now, but I will try to prepare it this week. I believe that any application that uses the retryable topics recovery mechanism is impacted.
Expected behavior
I expect the default behaviour of the retryable topics recovery system to be identical to version 2.8.3.
The text was updated successfully, but these errors were encountered: