cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nicolasdb
Advocate I
Advocate I

A flow with Apply to each takes never completes

Hi all, I'm transfering this from another topic since I think this is a bug. Transfered from Post #385406

----

I have a flow with an apply to each loop, making http calls for each item in the list. The whole process usually takes about 5-7 minutes to complete. I have even set timetouts on request to ensure it won't get stuck. The Flow is recurrent and runs every 5 minutes. Problem is, sometimes, the loop gets stuck forever. At least, I noticed today one instance ran for 19 hours, starting yesturday. If I cancel it and go in the run details to inspect, I see nothing running for more that a few seconds, except the global loop running time which is at 19 hours. Even the last item was processed within a second.

 

Oh and I even optimised the flow to remove any set variable, I use compose instead. I also added a safety check for running time but it's not hitting it since it's at the end of the loop itself, no further task is executed.

 

I even used FlowStudio to inspect the details and nothing took more that a few seconds to execute. It looks like a bug to me with the loop but maybe one can have a different input on that or a workaround. It's happening at least once a week and it happend twice this week already. Any idea?

 

Annotation 2019-10-17 111249.png

 

 

6 REPLIES 6
v-litu-msft
Community Support
Community Support

Hi @nicolasdb,

 

Could you please check each branch of the Run time has 19h? It may be stock by some branch that has timed out, not the last branch - 147.

I noticed that your condition is to check the current item whether it is time out. If it is, sends Error occurred notification?

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I wasn't able to inspect back my previous run of 19h but I was able to check on a later one that ran for 4 hours. The condition check you are talking about did work, I'm ensuring that my running time is smaller that 4h, which was exceed here. As you will see, the inspection doesn't reveal any running task of more that 1-2 seconds, except the loop itself! I really think this is a bug... if not an internal process of the apply to each or condition itself, maybe in the later run inspection.

 

Capture_oct25.JPG

Just a quick update, I had the problem today about 3 times on the same day! Last run was staled for about 3 hours while it normally run in around 5 minutes. Just as a remainder, I modified my Flow to use Compose instead of Set variable and also added timeout value for all http requests.

 

Need help please!

Hi @nicolasdb, curious if you've ever found a solution for this? I'm running into the same issues of a Flow sometimes never completing within an Apply to each loop. I've tried setting timeouts for actions that have this option and using Compose action instead of variables but to no avail. Thanks.

nicolasdb
Advocate I
Advocate I

@colonel_claypoo Unfortunately, I didn't find any solution yet. In fact, I changed my processing to filter the initial results (and thus the loop size) so I don't run on that error again. I don't understand why there's not much people complaining about this problem...

acaravantes
New Member

Hi! I´m also running into same issues. I have a flow with 'Apply to each' (with max parallelism degree enabled) with two simple actions: 'Split item by ;' and 'JSON Compose'. When the flow runs to proccess 2000 items, sometimes the loop has executed in 30s and sometimes never ends and i have to cancel the flow execution.

@v-litu-msftAny update on this?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,779)