feat: downgrade uncaught error log when reconciler handles the error#3494
Open
csviri wants to merge 2 commits into
Open
feat: downgrade uncaught error log when reconciler handles the error#3494csviri wants to merge 2 commits into
csviri wants to merge 2 commits into
Conversation
d098cd6 to
00e465d
Compare
When a reconciler's updateErrorStatus returns any ErrorStatusUpdateControl other than defaultErrorProcessing(), the error is now considered handled by the reconciler. Native retry (including @GradualRetry exponential backoff) is kept intact, but the framework logs the error on DEBUG level instead of emitting the "Uncaught error during event processing" WARN. This lets a reconciler keep retrying an expected, recoverable condition without producing a continuous stream of WARN messages, while it remains free to log the error at whatever level it wants inside updateErrorStatus. Returning defaultErrorProcessing() preserves the previous behavior, including the warning. - PostExecutionControl carries an errorHandledByReconciler flag - ReconciliationDispatcher marks the exception control as handled instead of rethrowing when a non-default control still wants retry - EventProcessor downgrades the retry-aware and no-retry-configured error logs to DEBUG when the error was handled by the reconciler Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
00e465d to
35504ad
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR changes error handling so that when updateErrorStatus returns a non-default ErrorStatusUpdateControl, the framework treats the error as “handled by the reconciler” and downgrades framework-level logging while keeping retry/backoff behavior intact.
Changes:
- Add an
errorHandledByReconcilerflag toPostExecutionControland propagate it fromReconciliationDispatcher. - Adjust
ReconciliationDispatcherto return an exceptionPostExecutionControl(marked handled) instead of rethrowing in the “handled-but-still-retry” scenario. - Downgrade relevant
EventProcessorerror logs toDEBUGwhen the handled flag is set, and add tests + docs for the new behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcherTest.java | Adds test coverage for the new “handled by reconciler” flag behavior. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java | Marks exception as handled (via PostExecutionControl) rather than rethrowing in the handled+retry path. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/PostExecutionControl.java | Introduces errorHandledByReconciler flag with setter/getter to carry handling state downstream. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/EventProcessor.java | Threads handled flag into retry + no-retry log paths and downgrades framework logs to DEBUG accordingly. |
| docs/content/en/docs/documentation/error-handling-retries.md | Documents the new semantics and logging behavior when updateErrorStatus returns non-default control. |
Comment on lines
+425
to
434
| if (errorHandledByReconciler) { | ||
| // The reconciler already handled the error in updateErrorStatus (and had the chance to log it | ||
| // as needed), so the framework only logs it on debug level while still retrying. | ||
| log.debug( | ||
| "Error during event processing {}, but was handled by the reconciler", | ||
| executionScope, | ||
| exception); | ||
| } else if (!retry.isLastAttempt() | ||
| && exception instanceof KubernetesClientException ex | ||
| && ex.getCode() == HttpURLConnection.HTTP_CONFLICT) { |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a reconciler's updateErrorStatus returns any ErrorStatusUpdateControl
other than defaultErrorProcessing(), the error is now considered handled by
the reconciler. Native retry (including @GradualRetry exponential backoff)
is kept intact, but the framework logs the error on DEBUG level instead of
emitting the "Uncaught error during event processing" WARN.
This lets a reconciler keep retrying an expected, recoverable condition
without producing a continuous stream of WARN messages, while it remains
free to log the error at whatever level it wants inside updateErrorStatus.
Returning defaultErrorProcessing() preserves the previous behavior,
including the warning.
of rethrowing when a non-default control still wants retry
logs to DEBUG when the error was handled by the reconciler