fix(executor): bound consecutive Plugin.Handle errors with a system-failure counter#7289
Merged
Merged
Conversation
0b45c96 to
4326c7a
Compare
9089e3b to
7fc0c2a
Compare
…ailure counter When Plugin.Handle returns a Go error (no phase transition), the TaskAction reconciler logs "Plugin Handle failed", emits an event, and requeues with the default duration. There was no system-failure attempt counter on this path, so a deterministic error — e.g. an admission webhook denying pod creation because a referenced secret cannot be found in any configured secret manager — would loop forever, leaving the TaskAction stuck in Queued. Mirror v1 propeller's MaxSystemFailures behaviour: - Add Status.SystemFailures (uint32) to TaskAction. - Increment it on every Plugin.Handle Go-error return, persist via Status update. - Reset to 0 on a successful Handle so transient errors don't accumulate across the lifetime of a long-running task. - Once the count exceeds DefaultMaxSystemFailures (30), synthesize a PhasePermanentFailure with code "MaxSystemFailuresExceeded" so the TaskAction terminates cleanly with the underlying error message preserved. - Threshold is overridable per-reconciler via TaskActionReconciler.MaxSystemFailures. This keeps the system tolerant of genuinely transient k8s API hiccups while ensuring deterministic failures eventually surface to the user. Signed-off-by: Kevin Su <pingsutw@apache.org>
7fc0c2a to
908efd8
Compare
Signed-off-by: Kevin Su <pingsutw@apache.org>
AdilFayyaz
reviewed
Apr 27, 2026
| "Plugin %q system error: %v", pluginID, handleErr) | ||
| } | ||
|
|
||
| taskAction.Status.SystemFailures++ |
Contributor
There was a problem hiding this comment.
are we resetting this back to 0? Suppose we hit 2 system errors and then a success, shouldn't this be reset?
Member
Author
There was a problem hiding this comment.
I'm not sure actually. we don't reset it in v1.
Contributor
There was a problem hiding this comment.
wouldnt it be an issue for long running tasks that may have transient failures followed by successes in between. Task could silently die after accumulating nonconsecutive maxSystemFailures
Member
Author
There was a problem hiding this comment.
that makes sense, let me update it
AdilFayyaz
approved these changes
Apr 27, 2026
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.
Why are the changes needed?
When the k8s API rejects pod creation via an admission webhook (e.g.
flyte-pod-webhookdenies the request because a referenced secret cannot be found in any configured secret manager),launchResourceinexecutor/pkg/plugin/k8s/plugin_manager.goreturned the error as a raw Go error withpluginsCore.UnknownTransitionand no phase transition.In
taskaction_controller.go, whenPlugin.Handlereturns a Goerror, the controller only logs"Plugin Handle failed", emits aFailedPluginHandleevent, and requeues with the default duration. It does not record a phase, increment any system-failure counter, or convert toPermanentFailure. As a result, the TaskAction stays inQueuedforever — the webhook will keep denying the same request, and there is no max-system-failure handling on this path.Repro:
Before the fix, the TaskAction loops forever with the webhook denial message in the controller log:
What changes were proposed in this pull request?
In
launchResource, before the generic system-error fall-through:isAdmissionWebhookDenial(err)that matches the canonical error string ("admission webhook"+"denied the request").k8serrors.IsInvalid(err)(invalid pod specs are equally non-transient).pluginsCore.PhaseInfoFailure("AdmissionDenied", err.Error(), nil)— a permanent failure phase — so the TaskAction terminates immediately with the underlying webhook message preserved for the user.How was this patch tested?
Manual end-to-end test using the bundled devbox:
flyte-devbox:latestwith this change (make -C docker/devbox-bundled build) and restarted the devbox.secrets=["test1"]).PermanentFailurein ~8s (single attempt) instead of getting stuck:Error State:Labels
Check all the applicable boxes
main