wberges
November 13, 2022, 2:47pm
4
Hello,
Same problem with test case reported in this existing GitHub issue (considering that if we are not able to stop a running workflow it can be considered as a bug, no? ;))
opened 02:58PM - 17 Oct 22 UTC
Hi,
I have posted the same question in the Flowable forum without getting muc… h 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.
Best Regards