Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT-24219: local variables before calling subprocess remains after en… #4596

Open
wants to merge 4 commits into
base: 7.11.x
Choose a base branch
from

Conversation

vrmoreira
Copy link
Contributor

…d of subprocess

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

Description

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

@vrmoreira
Copy link
Contributor Author

Tried to make the fix as clear as possible.
Anyway, think this diagram might shed some light. If this solution is approved, then I'll update the JIRA ticket
diagram

Comment on lines 239 to 247
Optional<? extends ExecutionEntity> first = parentExecution.getParent().getExecutions().stream()
.filter(executionEntity -> {
// scoped execution of the current subprocess should not be considered
return !executionEntity.getId().equals(parentExecution.getId());
} )
.findFirst();
if( first.isPresent() ) {
new SubProcessVariableSnapshotter().setVariablesSnapshots(first.get(), executionToContinue);
}
Copy link
Member

Choose a reason for hiding this comment

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

This logic only works for some specific cases, but it cannot work in general: parentExecution.getParent().getExecutions() may return several executions depending on the process design and peeking the first one could return the wrong one. Also, there is no guarantee that the execution we are looking for is still in the database at this point, as it's marked to be deleted in ContinueProcessOperation.createChildExecutionForSubProcess and depending on the process design it may or may not be there. For instance, if the subprocess has a user task or any flow node marked as async, the execution will be already deleted from the database when we reach this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've improved the fetch of the execution but it fails when a UserTask is inside of the subprocess: the execution was already deleted.
Pushed modifications in order to continue the discussion

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.

None yet

2 participants