Vadim Tabakman

Nintex Workflow comes with a concept called Safe Looping, which is enabled by default.

Safe Looping was created to protect the SharePoint environment from a workflow which goes into a infinite loop and inadvertantly affects the SharePoint environment in a negative way (high CPU usage).

The way it does this, is during the process of publishing the workflow, if there are Change State actions, a hidden delay action is added (single timer service cycle - usually 5 minutes).  Also, during each iteration of the Loop action, a hidden delay is added.

Where is Safe Looping enabled?

In Central Administration > Nintex Workflow Management > Global Settings

Safe Looping

You will find an option called "Enforce safe looping". Set it "yes" to enable it.

When making changes in Global Settings, these changes are not automatically applied to the farm.  Usually, 15-20 mins and the change will propagate throughout the farm.  Alternatively, perform an IISRESET and this happen now.

What are the risks?

With Safe Looping disabled, you risk having workflows go into infinite loops and potentially have high CPU load on a SharePoint server.

If you have a Loop action, your workflow could get stuck in this loop, going through the loop continuously as fast as the server will let it, using up as much CPU processing power as possible.

In either of these cases, high CPU load on a server would result in slow SharePoint performance and end users will find slow responses from pages, other workflows may be affected during run time and you may generally get timeouts because the server doesn't respond to requests on time. With the server being so busy, you may even find it difficult to terminate this workflow because the server can't respond.

With Safe Looping enabled, you risk having a workflow that looks to be quite simple, have hidden delays and potentially run a lot longer than you would normall expect.


When it comes down to it, having Safe Looping enabled is the preferred option.  You can't guarantee that one of your employees won't design a workflow with a loop that will continue forever, due to some workflow logic mistake.  From a corporate stand point, you would rather a workflow take longer to run, rather than risk bringing down your farm.


I recently got asked a question on how to find out the number of weekdays between two dates.

The quick (as in design-time) way, would be to have a loop that iterates through each day and figures out what it is (weekday or weekend).

The risk here, is if you have 2 days that are very far apart, each iteration through the loop would cause a hidden Safe Looping delay.

The alternate way, is it figure out a way to do this without Loops or Change States.

The down side to this way, is that it increases design time dramatically because you need to build the logic to actually do this and test it out.  It will also increase the size of the workflow, so your best to put this type of logic into a User Defined Action.

In my test, my loop UDA was 34kb and my no-loop UDA was 128kb

I won't be going into the User Defined Actions themselves as what they do is fairly straight forward.  So I'll leave that up to the reading.  You can download the UDAs below.


If you have a loop that runs the logic inside it 100 times, with Safe Looping enabled you could potential have 5 mins multiplied by 100 iterations = 500 mins.  This translates to a little over 8 hours.

Without safe looping, this could potentially run in very little time (unless you had delays or task actions).

Unknown Workaround

If you have a time sensitive workflow, Safe Looping may not be an option.  Remember, the hidden delay is put into the workflow at the time of publishing the workflow.

So if you don't want a workflow to have Safe Looping in it, you can disable Safe Looping in Central Admin > Nintex Workflow Management > Global Settings.  Perform an IISRESET.

Next, open the workflow in design mode, publish the workflow and it will now have no Safe Looping in it.

Turn Safe Looping on in Central Admin.

You now have a workflow without Safe Looping, and any other workflows you design will have Safe Looping in them.


Posted by Vadim Tabakman Sunday, November 4, 2012 8:59:00 AM Categories: Change State For Each Iterate Loop Math Calculations Nintex Nintex Workflow Safe Looping User Defined Actions
Copyright Vadim Tabakman
Rate this Content 0 Votes


Tuesday, November 13, 2012 5:42:03 AM

re: Nintex Workflow - Safe Looping

Thanks for the useful clarification Vadim.

May be you had experience with what I found recently too: could it be that safe looping also has a hidden secret that prevent from looping during office hours if it is still running after a few hours? 

I have a case with a loop checking for a value every 5 minutes, and it is still running fine after days but only between 10:30pm and 1am. There was no issue with the timerjob whatsover, just seems "normal" for the loop to try again between this range, then pause during the day and try again at night.

ODD no ?

Just wondering if safe looping would have another mystery.

Wednesday, December 12, 2012 7:49:12 AM
Michael Miller

re: Nintex Workflow - Safe Looping

Hi Vadim:

This calculation that excludes weekend in a date calculation is exactly what I am looking for. Your download is a *.nwf file. Can you also make it available as a *.uda so I can import to my User Defined Actions?

Thank you.

Wednesday, December 12, 2012 8:14:58 AM

re: Nintex Workflow - Safe Looping

Hi Michael,

I put up the UDA files.  Hope that helps.



Wednesday, December 12, 2012 11:55:12 AM
Michael Miller

re: Nintex Workflow - Safe Looping

Thank you Vadim for responding so promptly. It is working perfectly. Smile

Thank you for posting this action; it will save Nintex users a lot of time. Hopefully they build this functionality into their next release.

Wednesday, December 12, 2012 11:56:09 AM

re: Nintex Workflow - Safe Looping

No problem Michael.  Glad it helps you. Smile

Monday, November 3, 2014 1:57:04 PM

re: Nintex Workflow - Safe Looping

Vadim, any advice on how to kill an infinite loop if one gets going, without safe looping enabled?

Tuesday, July 28, 2015 9:36:17 AM

re: Nintex Workflow - Safe Looping

Hey.. Same question as Eric.  Any way to shut a WF that has got into an infinite loop? 

Wednesday, July 29, 2015 8:44:18 AM

re: Nintex Workflow - Safe Looping


hmm I've never really had to do it, so I'm not 100% sure.

I'd say, Workflow History and terminate it.  That will probably no help straight away.  An IISRESET should then do the trick because afterwards, SP Will try to resume the workflow but you've internally set the flag to say it's terminated.  So that should help.




Thursday, October 22, 2015 4:30:16 AM

re: Nintex Workflow - Safe Looping

Thanks a lot, perfect solution. My wokrflow has state machine and one fine day it was stuck.

I tried above options and it worked :)

Monday, January 11, 2016 3:44:40 AM

re: Nintex Workflow - Looping

I have a "Loop" action in my workflow . But it always executes only one time .


 I tired this using several conditions but no luck. Anyone faced this issue before?


Monday, January 11, 2016 8:07:36 AM

re: Nintex Workflow - Safe Looping

Hi Sabari,

is it stuck in the loop, or does it continue with the workflow?

If it's stuck on the loop, you have an issue with the safe looping as mentioned in this post.

If it jumps out of the loop and continue with the workflow, you have an incorrect condition.

Try a simple condition line :

1 not equals 0

This should go into an infinite loop.  Inside the loop, if you have Safe Looping off, make sure you add a Pause/Delay action so you don't get a runaway workflow.

Also, add a Log action into the loop, so you can see the workflow history if it does run more than once.



Wednesday, January 20, 2016 12:16:16 AM

re: Nintex Workflow - Safe Looping

Hi ,


I restarted timer job and it worked fine..but it again happened when i run this workflow for two items.


 Why its happening frequently? any permanent fix for this? I check workflow history logs size all are minimum .


Anyother things I need to check?


Wednesday, January 20, 2016 8:56:54 AM

re: Nintex Workflow - Safe Looping

Hi Sabari,

I don't know the cause of this, other than the Timer Service being in a bad state.  But I don't know what causes that.



Wednesday, January 27, 2016 10:44:31 PM
Mish Bayoumi

re: Nintex Workflow - Safe Looping

Hi Vadim,


Thanks for the information, i was stumped as to why my simple workflow was taking 20 min to complete. I am also using a loop to calculate next working day based on querying a table filled with weekends and holidays. Could you give an outline of how you did it without using the loop? Our ability to use UDFs was restricted by our admins and i can't open your file to see how you did it.





Wednesday, January 27, 2016 11:51:10 PM

re: Nintex Workflow - Safe Looping

Hi Mish,

I've put the logic into a workflow and it's the last link in the Downloads section of this post.  I've labeled all the actions, so I hope it's easy to follow.


Tuesday, March 29, 2016 11:12:05 PM

re: Nintex Workflow - Safe Looping

Hello Vadim,

Can you please help me, i need to calculate difference between two dates excluding weekends and holidays in Sharepoint.





Wednesday, March 30, 2016 7:20:21 AM

re: Nintex Workflow - Safe Looping

Hi Pushpa,

I don't have any examples of that.  If you post that question on the Nintex Community forums, you'll more likely get a better answer than mine :).

Hope you find an easy way.


You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?


  • Entries (295)
  • Comments (1778)