Issue
A workflow configured with long-running logic (i.e. updating 5000 items) runs for 15 minutes and then stops with 'Failed to Run'.
Error Code
RunWorkflow: System.Threading.ThreadAbortException: Thread was being aborted. at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)
You may also see
SPTimeoutThreadExecution timed out after 900000 milliseconds. Cancelling operation.
Resolution
In SharePoint Management Shell, conduct the following steps:
- Observe the current value of the 'SingleWorkflowEpisodeTimeout' property
Get-SPWorkflowConfig -WebApplication http://WebApplicationURL
Note: The default value is 900 seconds
- Set the 'SingleWorkflowEpisodeTimeout' property to meet your needs
Set-SPWorkflowConfig -WebApplication http://WebApplicationURL -SingleWorkflowEpisodeTimeout 1800
Note: The above command would set the timeout to 1800 seconds (30 minutes)
Additional Information
The SingleWorkflowEpisodeTimeout property was introduced in SharePoint 2016 and is not available in earlier versions of SharePoint.