# Cancel process with infinite loop inside service task

**URL:** <https://forum.flowable.org/t/cancel-process-with-infinite-loop-inside-service-task/6737>\
**Category:** Flowable Engine\
**Created:** [September 18, 2020, 12:29pm UTC](https://forum.flowable.org/t/cancel-process-with-infinite-loop-inside-service-task/6737 "2020-09-18T12:29:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.flowable.org/u/Ivan)\
**Post date:** [September 18, 2020, 12:29pm UTC](https://forum.flowable.org/t/cancel-process-with-infinite-loop-inside-service-task/6737/1 "2020-09-18T12:29:27Z")

</div>

Hi!

I’m new to Flowable so I could need some help. I searched trough but did’t find an answer.  
My case:  
I have a simple process made in Flowable modeler that looks like this:  
 ![Capture](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/0/0a2f5577dbb82566cd6eb1fb9c82439f69c35358.png)

When I start the process inside Flowable task it runs as expected. But when I cancel the process it finishes in Flowable task. But when I look inside the logs I see it is still going on. What could be the problem?

How to implement an infinite loop that can be terminated trough “Cancel process” button?  
Thanks in advance.

Regards,  
Ivan

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [September 22, 2020, 10:05pm UTC](https://forum.flowable.org/t/cancel-process-with-infinite-loop-inside-service-task/6737/2 "2020-09-22T22:05:46Z")

</div>

That’s not possible: cancelling can only be done when a process instance is in a wait state. In this case, the process instance will run, most likely until the database transaction times out.

The upcoming release has support for ‘Future JavaDelegates’, which would allow to stop (however, we haven’t exposed it yet on the cancel). See more details here: [https://blog.flowable.org/2020/08/06/true-parallel-service-task-execution-with-flowable/](https://blog.flowable.org/2020/08/06/true-parallel-service-task-execution-with-flowable/)

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.flowable.org/u/Ivan)\
**Post date:** [September 23, 2020, 6:07am UTC](https://forum.flowable.org/t/cancel-process-with-infinite-loop-inside-service-task/6737/3 "2020-09-23T06:07:54Z")

</div>

Thank you very much on this answer! 🙂
