Steps to reproduce
See failing test case.
Expected behavior
If the activity instances are canceled by the interrupting event subprocess, ...
- the status of the historical process instance should remain ACTIVE
- no endDate should be set to the historical process instance
Observed behavior
If the activity instances are canceled by the interrupting event subprocess, ...
- the status of the historical process instance should remain INTERNALLY_TERMINATED
- an endDate is set to the historical process instance
Problem 1
Wrong state of the historic process instance is written to the database.
Problem 2
Precondition: The removal time strategy is set to start and a time to live is specified
- The process instance end event in the historic event producer is triggered
- This writes the data to be updated related to the historic process instance (e. g. end time, duration, etc.) to the database entity cache
- The removal time is in this case null because it hasn't been changed
- All subsequent historic events (e. g. creating a historic task instance) within the same transaction retrieve the removal time of null from the database entity cache and these events are inserted with a removal time of null to the database
Please see the following test case for problem 2:
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/test/java/org/camunda/bpm/engine/test/history/HistoricProcessInstanceStateTest.java#L290-L322