camunda-bpm-platform
camunda-bpm-platform copied to clipboard
End event is not fired after cancellation for inactive execution
Environment (Required on creation)
All supported versions.
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)
In an edge case of chaining multiple activity cancellations, the history activity instance endTime
is not set.
This is an edge case with splitting and merging parallel gateways and two activity cancellations.
Steps to reproduce (Required on creation)
- Create and start a process with two parallel gateways (splitting and merging) with two sequence flows. One flow contains a wait state (e.g. intermediate event), while the other sequence flow will finish without wait states (see image). There will be two tokens. One is on the merging gateway, and one is on the intermediate catch event (waiting for a message).
- Cancel the intermediate event activity first, then cancel the merging parallel gateway activity.
- The history activity instance of the merging parallel gateway won't have
endTime
set. The activity end is not fired and the history producer is not triggered.
Process model:
Observed Behavior (Required on creation)
The activity end is not fired, thus the history producer is not triggered.
The history activity instance of the second parallel gateway won't have endTime
set.
Expected behavior (Required on creation)
The activity end is fired, and the history producer is triggered.
The history activity instance of the second parallel gateway has endTime
set.
Root Cause (Required on prioritization)
After the first cancellation, the execution tree is compacted, so that the root process points to the merging gateway activity.
The parallel gateway is executed, which deactivates the execution, and the gateway can't complete, since it is waiting for one more execution to join but the missing execution has been canceled (and pruned).
The second cancellation cancels "Gateway_out", but since the execution is not active anymore, no end event is sent.
Without an event, the history producer is not triggered and no endTime
is set.
Executions
Initial executions:
- ProcessInstance[5]
- ConcurrentExecution[8] - "Gateway_out"
- ConcurrentExecution[9]
- ScopeExecution[11] - "Event_Wait"
After canceling "Event_Wait" and pruning concurrent child:
- ProcessInstance[5] - "Gateway_out"
Solution Ideas
- Fire end event if there is a cancellation, even if the execution is not active anymore. See linked PR.
- Avoid an execution tree compaction where a gateway ends up in a situation where it can't meaningfully continue.
Hints
Links
- https://jira.camunda.com/browse/SUPPORT-18988
Breakdown
### Pull Requests
- [ ] https://github.com/camunda/camunda-bpm-platform/pull/3905
- [ ] https://github.com/camunda/camunda-bpm-platform/pull/4124
Dev2QA handover
- [ ] Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment
I will backport the PR after the 7.21 merge
Backports are ready