'Sharepoint 2010 Workflow Intermittently shows Error Occurred

Using and InfoPath form, a person will submit a request to a form library. Upon creation of new item in the library, the workflow (using SharePoint Designer out of the box functionality - no code) is set to automatically start. It's a fairly simple workflow with 3 approval steps. 75% of the time it runs perfectly fine, 25% of the time it will switch to 'Error Occurred'. It particularly seems to error more often in the morning hours, although not limited to that time of day. I've read just about every article out there and have not found a solution.

-Workflow history screen will show 'Note: Due to heavy load, the latest workflow operation has been queued. It will attempt to resume at a later time', until it finals errors.

-Have already increased workflow throttle and batch size, issue seems to of gotten worse since then

-Workflow history will says 'An error has occurred in [workflow name]' by the system account.

-There appear to be no batch jobs running at the same time, no heavy work like backups occurring

-This is occurring on more than one workflow for more than one form library, they are all completely not related to each other

-We've checked our CPU on the server, no spikes during that time, we have plenty of memory. We don't have a lot of workflows running at the same time. Particularly in the morning when I'm seeing this occur the most, I'm just about the only user submitting forms and kicking off workflows.

-We have checked to ensure our times are synced on the server (they are by 1 second) and that we have time zones set in our web applications

-If you manually restart the workflow on one that had errored, it will process through fine again on the second try (based on that, assuming this means it can't be related to how the SPD workflow was built or permissions)

-Tried logging to the workflow history to see where it errors, my logging prior to the 'approval process' step does appear in the history... workflow appears to fail upon trying to initiate the first task. Again, restarting workflow works fine and does assign the task, so I don't think it could be related to anything with the task list.

Any suggestions that you may have to help me out here would be greatly appreciated!

Below are the errors logs from 14:

*Unexpected WinWF Internal Error, terminating workflow Id# f413610c-0981-4c37-9583-1d7cac4f0265

09/12/2013 06:57:42.65 w3wp.exe (0x2768) 0x1740 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.SharePoint.SPException: The context has expired and can no longer be used. (Exception from HRESULT: 0x80090317) ---> System.Runtime.InteropServices.COMException (0x80090317): The context has expired and can no longer be used. (Exception from HRESULT: 0x80090317) at Microsoft.SharePoint.Library.SPRequestInternalClass.SetHttpParameters(String bstrHttpMethod, String bstrRequestDigest, UInt32 flags, Guid gTranLockerId, Byte[]& ppsaImpersonateUserToken, Boolean bIgnoreTimeout, String bstrUserLogin, String bstrUserKey, UInt32 ulRoleCount, String bstrRoles, Boolean bWindowsMode, ApplicationPrincipalInfo& pAppUserInfo, Boolean bInvalidateCachedConfigurationProperties, Int32 lAp...

09/12/2013 06:57:42.65* w3wp.exe (0x2768) 0x1740 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected ...pDomainId, ISPManagedObjectFactory pFactory, Boolean bCallstack) at Microsoft.SharePoint.Library.SPRequest.SetHttpParameters(String bstrHttpMethod, String bstrRequestDigest, UInt32 flags, Guid gTranLockerId, Byte[]& ppsaImpersonateUserToken, Boolean bIgnoreTimeout, String bstrUserLogin, String bstrUserKey, UInt32 ulRoleCount, String bstrRoles, Boolean bWindowsMode, ApplicationPrincipalInfo& pAppUserInfo, Boolean bInvalidateCachedConfigurationProperties, Int32 lAppDomainId, ISPManagedObjectFactory pFactory, Boolean bCallstack) --- End of inner exception stack trace --- at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) at Microsoft.SharePoint.Library.SPRequest.SetHttpParameters(String bstrHttpMethod, String bstrRequestDigest, UInt32 flags, Guid gTranLock...

09/12/2013 06:57:42.65* w3wp.exe (0x2768) 0x1740 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected ...erId, Byte[]& ppsaImpersonateUserToken, Boolean bIgnoreTimeout, String bstrUserLogin, String bstrUserKey, UInt32 ulRoleCount, String bstrRoles, Boolean bWindowsMode, ApplicationPrincipalInfo& pAppUserInfo, Boolean bInvalidateCachedConfigurationProperties, Int32 lAppDomainId, ISPManagedObjectFactory pFactory, Boolean bCallstack) at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) at Microsoft.SharePoint.SPSite.GetSPRequest() at Microsoft.SharePoint.SPSite.get_Request() at Microsoft.SharePoint.SPSite.InitSite() at Microsoft.SharePoint.SPSite.get_SystemAccount() at Microsoft.Shar...

09/12/2013 06:57:42.65* w3wp.exe (0x2768) 0x1740 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected ...ePoint.WorkflowActions.Helper.SplitMultiUserToObjects(WorkflowContext context, Object val) at Microsoft.SharePoint.WorkflowActions.Helper.MultiDisplayNameSemicolon(WorkflowContext context, Object val) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Ob...

09/12/2013 06:57:42.65* w3wp.exe (0x2768) 0x1740 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected ...ject[] parameters) at Microsoft.SharePoint.WorkflowActions.CoerceActivity.Coerce() at Microsoft.SharePoint.WorkflowActions.CoerceActivity.Execute(ActivityExecutionContext provider) at System.Workflow.ComponentModel.ActivityExecutor1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()*



Solution 1:[1]

Clear the workflow history and keep minimum possible items in there ... Large workflow history list sometimes cause serious performance issue and also issues with Auto start workflow activities. I guess the reason behind it is explained in list Throttle limits defined in SP 2010 : Plz refer : http://blogs.technet.com/b/speschka/archive/2009/10/27/working-with-large-lists-in-sharepoint-2010-list-throttling.aspx http://code.msdn.microsoft.com/CleanWorkflowHistory

Solution 2:[2]

The token timeout had been set to 1 a few months ago to resolve a different issue with check permissions. Resetting this value to 10 has resolved this issue.

stsadm.exe -o setproperty -propertyname token-timeout -propertyvalue 10

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SPG
Solution 2 Codeless SharePoint