Recently I noticed that some of my flows end up with many running flows.
Types of flows
There are a few different types of flows
- Manual cloud flows
- Scheduled cloud flows
- Automated cloud flows
When I looked into the issues of many flow runs, I found that they were always scheduled flows.
And whenever I would open the flows there would be an apply to each that was stuck.
The difficult thing is that when you open up the apply to each , you will not find out what is actually happening.
How can we debug this?
3 steps to debugging multiple running flows
I’m going for the following approach:
- Stop the flow
- Find clues and fix the flow
- Restart the flow
To stop the flow I first go to the flow and select the turn off option.
This will stop any new instances starting up.
You could now cancel all the flow instances that are running. This can be a really boring job, but it might have to be done at some point. However this is not the right moment, as I want to see where the flows are failing/hanging or timing out.
In the All runs, you will find the Running flows but also some failing or maybe successful flows.
In my case I have some failing flows. When I look at my failing flow I found a delay action failing.
Gosh, what is this about? If we can’t even wait properly then what can we do.
The error that goes with this failure says:
The provided ‘Wait’ action ‘interval’ value ‘1’ ‘Second’ is not supported for the ‘Consumption’ SKU. The value must be between ‘5’ seconds and ’30’ day(s).
Ok, so I’ve got a trial that has expired and now I’m only allowed to wait for 5 – 30 seconds. The reason for he delay was to reduce the pressure on the SharePoint connector a bit. So in this case waiting for 5 seconds probably isn’t too bad.
But this doesn’t explain why the flows are suddenly never finishing or does it?
Well, you might have noticed recently all sorts of warnings in flows that tell you when there are too many failures or too many actions run by your flows.
Have you noticed that in the apply to each steps, if any action fails, that the apply to each simply continues? In my example above one flow run would generate 465 errors. On a scheduled flows that will quite quickly result in many errors.
Looking at the analytics of the flow you can quite quickly notice that there is something wrong!
When you get too many errors, apply to each steps seem to go into a never ending pause state.
So what should we do?
- avoid errors inside large apply to each steps.
- protect your flow from running multiple instances (unless it is a requirement for this to happen)
- avoid apply to each steps, where possible
- buy a premium licence 😉 as it avoids issues like mine
Now the next step is to cancel the running flows and restart my flow.
So how do we protect our flow?
Protect a flow and stop many running flows issues
To stop the issues of many running flows you could create a SharePoint list. Call this list locks or something like that and create one item in this list.
At the start of the flow read the item and check the value of the item. If it is locked then don’t run the following steps. You can do this using a condition step.
Then within the code that you want to run set the item to locked. And at the end of your flow write to the lock item and set it to unlocked.
Then finally you might want to send yourself an email when the flow is trying to start while the flow is already running.
This way of protecting your flow might not fix the issue, but it does avoid you having to cancel 100s of flows running.
7 thoughts on “Many running flows in Power Automate”
This article highlights perfectly why Flow is not suitable for Enterprise deployments. It is unacceptable if a flow contains no errors, then throws exceptions like the above because of tenant load/timings/preview actions. Too many actions have been in ‘Preview’ for years meaning MS can delete/modify them when they choose – list the Teams actions to see what I mean! It is about time MS focus on finishing existing features rather than rollout new ones as they try and compete in the consumer sector #fail
Hi Nigel, For enterprise deployments, shouldn’t you consider premium licences?
[…] Recently I noticed that some of my flows end up with many running flows. Types of flows There are a few different types of flows Manual cloud flows Scheduled cloud … Read More […]
Regarding the last part – doesn’t simply setting concurrency control of the trigger to 1 solve the issue of multiple running flows?
The approach would be fairly similar however, in my case I would also like to know when a previous run is taking too long. Hence if I get the flow rather than the trigger to control this I can for example send myself an email with an alert. Rather than letting the longer running flows just happen.
Do you have any advice for when flows run so long they cause power automate to turn the flow off? If I cancel the extra long runs, I cannot see inside loop it got stuck in. If I wait for the run to end itself, it may run so long the flow turns off, or it may hit the 30 day run limit and then it cancels itself anyway. Nowhere in that scenario is a way for me to see any actual error messages. I cannot ever see inside my flow run, so I don’t know how to troubleshoot it.
Hi Rachael, I would create child flows for the steps inside the apply to each. Then you can debug the child flow instead.