Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

Many running flows in Power Automate

Recently I noticed that some of my flows end up with many running flows.

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

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.

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

The difficult thing is that when you open up the apply to each , you will not find out what is actually happening.

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

How can we debug this?

3 steps to debugging multiple running flows

I’m going for the following approach:

  1. Stop the flow
  2. Find clues and fix the flow
  3. Restart the flow

To stop the flow I first go to the flow and select the turn off option.

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

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.

Many Running flows

In my case I have some failing flows. When I look at my failing flow I found a delay action failing.

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

Gosh, what is this about? If we can’t even wait properly then what can we do.

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

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!

Many running flows in Power Automate Microsoft 365, Microsoft Power Automate

When you get too many errors, apply to each steps seem to go into a never ending pause state.

So what should we do?

  1. avoid errors inside large apply to each steps.
  2. protect your flow from running multiple instances (unless it is a requirement for this to happen)
  3. avoid apply to each steps, where possible
  4. 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.

5 thoughts on “Many running flows in Power Automate

  1. 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

  2. Hi Pieter,
    Regarding the last part – doesn’t simply setting concurrency control of the trigger to 1 solve the issue of multiple running flows?

    1. Hi Michal,

      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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: