flowable-engine
flowable-engine copied to clipboard
Deletion of running process fails
Hi,
I have posted the same question in the Flowable forum without getting much traction on the thread (https://forum.flowable.org/t/how-to-delete-a-process/9805) so I try here once again:
Back then in Activiti and up to Flowable 6.2 the following code worked as (at least I) expected:
RuntimeService runtimeService = processEngine.getRuntimeService();
String pId = runtimeService.startProcessInstanceById (processDefinition.getId ()).getId ();
System.out.println ("Process " + pId + " started");
// give process some time to "do" something
Thread.sleep (3000);
System.out.println ("Deleting process " + pId);
runtimeService.deleteProcessInstance (pId, null);
System.out.println ("Process deleted");
Process 5 started Deleting process 5 Process deleted
The process starts, runs some time and then gets terminated.
The Flowable version currently in use (6.7.2), however, gives me an exception in line :
runtimeService.deleteProcessInstance (pId, null);
Concurrent update in table “ACT_RU_EXECUTION”: another transaction has updated or deleted the same row [90131-212]
The process used to demonstrate this behavior is trivial: One asynchronous ServiceTask between Start and End events. The task is a Java class simply doing a sleep ().
While I seem to understand what happens, I’m somewhat puzzled.
Is this behavior change intended? If so, what is the recommended way to delete a running process instance?
Thanks, Steffen.
Hello,
I have exactly the same problem.
It appears that, when an execution is running in a process, the deleteProcess generates an error and a DB rollback, meaning that the process continues (except if it crashed...). I tried to reproduce the issue with the simple workflow below:
- delete during the timer => fails
- delete during the running STEP2 task => fails
- suspend during the timer => fails
- suspend during the running STEP2 task => fails
- cancel event during the timer => seems to work
- cancel during the running STEP2 task => fails
So my question is the same as @SteffenMeissner : how can we stop running workflows in a 100% safe and successful way? The problem also is that the existing workflows are not designed to handle cancel events, so it would require a migration if the cancel event is the only solution (which even doesn't seem the case, depends on the current step...)
Thanks Best Regards
Here's the APP zip: test_delete_running_process.zip