-
Notifications
You must be signed in to change notification settings - Fork 1.7k
GH-3884: Clarify exception handling behavior for Error vs RuntimeExce… #3886
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
Conversation
… vs RuntimeException Fixes: spring-projects#3884 Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
artembilan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not critical , but pay attention how PR title looks ugly because of too long commit message head line.
| The `DefaultErrorHandler` only processes exceptions that inherit from `RuntimeException`. | ||
| Exceptions inheriting from `Error` bypass the error handler entirely, causing the consumer to terminate immediately, close the Kafka connection, and skip all retry/recovery mechanisms. | ||
| This critical distinction means applications may report healthy status despite having terminated consumers that no longer process messages. | ||
| Always ensure that exceptions thrown in message processing code extend from `RuntimeException` rather than `Error` to allow proper error handling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure how to help, but this is not true. The OutOfMemoryError is really out of our control . Do you have any advice how really we can make Error as RuntimeException? What is the goal of this sentence if we don’t provide any example how to do that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant any exceptions thrown explicitly by the applications. I can rephrase if needed. Things like OOME are outside the application's control, and we can't help. This issue was raised because someone was accidentally placed Kotlin's TODO method that throws an Error. This clarification is basically to navigate the users of those scenarios.
spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/annotation-error-handling.adoc
Outdated
Show resolved
Hide resolved
spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/annotation-error-handling.adoc
Outdated
Show resolved
Hide resolved
Signed-off-by: Artem Bilan <artem.bilan@broadcom.com>
…ption
Fixes: #3884