fix: bound invocation lifecycle and cleanup - #733
Draft
zhongkechen wants to merge 16 commits into
Draft
zhongkechen wants to merge 16 commits into
zhongkechen wants to merge 16 commits into
Conversation
added 14 commits
September 22, 2026 21:10
4 tasks
zhongkechen
added this pull request to stack #732
September 25, 2026 17:28
This branch has not been deployed
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.
Issue Link, if available
Partial fix for #726, covering invocation deadlines, bounded shutdown, root-cleanup/
PENDINGordering, and interruption-safe checkpoint cleanup. Stacked on #731. Shared fixed-executor starvation remains separate follow-up work.Description
This turns the task ownership added by #731 into a bounded invocation lifecycle without changing durable replay identities or shutting down executors shared by other invocations.
Context.getRemainingTimeInMillis(), reserving cleanup and response headroom.DRAININGbefore response preparation, reject new durable operations/tasks, and holdPENDING,SUCCEEDED, orFAILEDuntil the root wrapper and all invocation-owned task wrappers have actually exited.Future<?>. A task that ignores interruption cannot be forcibly stopped, but cleanup remains bounded and the closed manager rejects its later SDK operations/checkpoints.UnrecoverableDurableExecutionException; preserve the original cause and retain an original execution outcome as a suppressed exception when cleanup becomes the primary failure.finallyeven when draining or checkpoint shutdown fails.ApiRequestDelayedBatchershutdown; remove the previous unbounded operationFuture.get()and batch-flushjoin()paths from invocation cleanup.onInvocationEndonly after task drain and checkpoint cleanup have completed.The current internal budgets are 500 ms execution-deadline headroom, 100 ms response headroom, up to 5 seconds graceful task drain, up to 1 second cancellation drain, and a 30-second cleanup cap for local/null-context execution. A real Lambda context always constrains these caps further.
This PR targets
feature/lmi-invocation-scope, the head branch of #731. It should be retargeted tomainafter #731 lands.Testing
mvn -pl sdk spotless:check test— 1,178 tests passed, 3 opt-in LMI tests skipped.mvn test— all 10 reactor modules passed, including 405 SDK integration tests, plugins, examples, conformance fixtures, and LMI fixture compilation; 31 cloud example tests remained disabled.mvn -pl sdk -am -DskipTests javadoc:javadoc— passed; two pre-existingWaitForConditionOperationlink warnings.mvn -pl sdk '-Dtest=LmiLifecycleRegressionTest#pendingMustWaitForRootFinally+deadlineMustCancelAnInvocationOwnedTaskAndBoundCleanup' -Dtest.lmi.regressions.enabled=true test— both lifecycle regressions passed.LmiLifecycleRegressionTest— lifecycle/deadline cases passed; the two fixed-executor parameterizations still failed as expected because executor separation is not part of this PR.PENDINGplusonInvocationEndordering after rootfinally.Cloud LMI execution was not run locally because it requires the configured persistent capacity provider; #728 supplies that validation workflow.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.