Clearing additional objects map - #1572
Merged
fjtirado merged 1 commit intoJul 27, 2026
Merged
Conversation
10 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent retained WorkflowMutableInstance objects (notably scheduled instances) from holding onto metadata indefinitely by clearing the instance’s additionalObjects map when execution completes.
Changes:
- Clear
additionalObjectsduring workflow completion cleanup inWorkflowMutableInstance.whenCompleted(...).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Besides calling Closeable for every additional object, the holding map should be clear in case the WorkflowInstance is not removed from memory (which currrently might happen only for scheduled instances) Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
fjtirado
force-pushed
the
empty_additional_objects
branch
from
July 27, 2026 11:38
e40cbb8 to
dca936c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java:131
handleExceptionis now only invoked fromwhenCompleted, which is attached toprocessTaskList(...). If an exception occurs later in the chain (e.g., inwhenSuccessoutput filtering/schema validation, or duringonWorkflowCompletedevent publication), the overall future will complete exceptionally but the instance will not be markedFAULTEDandWorkflowFailedEventwill not be published (regression vs. whencleanUphandledex). Consider handlingexincleanUpas well (guarded to avoid double-reporting).
additionalObjects.clear();
workflowContext.definition().removeInstance(this);
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.
Besides calling Closeable for every additional object, the holding map should be clear in case the WorkflowInstance is not removed from memory (which currrently might happen only for scheduled instances)