Skip to content

Clearing additional objects map - #1572

Merged
fjtirado merged 1 commit into
open-workflow-specification:mainfrom
fjtirado:empty_additional_objects
Jul 27, 2026
Merged

Clearing additional objects map#1572
fjtirado merged 1 commit into
open-workflow-specification:mainfrom
fjtirado:empty_additional_objects

Conversation

@fjtirado

@fjtirado fjtirado commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 additionalObjects during workflow completion cleanup in WorkflowMutableInstance.whenCompleted(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java Outdated
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>
Copilot AI review requested due to automatic review settings July 27, 2026 11:38
@fjtirado
fjtirado force-pushed the empty_additional_objects branch from e40cbb8 to dca936c Compare July 27, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • handleException is now only invoked from whenCompleted, which is attached to processTaskList(...). If an exception occurs later in the chain (e.g., in whenSuccess output filtering/schema validation, or during onWorkflowCompleted event publication), the overall future will complete exceptionally but the instance will not be marked FAULTED and WorkflowFailedEvent will not be published (regression vs. when cleanUp handled ex). Consider handling ex in cleanUp as well (guarded to avoid double-reporting).
    additionalObjects.clear();
    workflowContext.definition().removeInstance(this);

@fjtirado
fjtirado merged commit 2071e65 into open-workflow-specification:main Jul 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants