Troubleshooting Workflows in SharePoint 2010

SharePoint 2010 leverages on Workflow Foundation (WF) found in the .NET Framework 3.5 SP1. From architectural perspective there are no big differences between SharePoint 2010 workflows and SharePoint 2007 workflows. SharePoint 2007 introduced workflow to the SharePoint platform via .NET Framework 3.0.

SharePoint 2010 Workflow is using the following two hosts:

  • W3WP.exe – Hosts workflow instances that start following a user interaction
  • OWSTimer.exe (Workflow Timer Job) –Hosts workflow instances that will be executed after a delay

The timer job that is used for the workflow execution is:

  • Microsoft.SharePoint.Workflow. SPWorkflowTimerService

The following action plan can be applied for different workflow scenarios like: workflows are in continuous processing, workflows are stuck, workflows are not starting, etc..

  •  Check the event handlers on the list
  • Change the logging level to verbose mode and search for OWSTIMER errors like:

   OWSTIMER.EXE (0x133C) 0x08FC SharePoint Foundation Timer 5uuf High The previous instance of     the timer job ‘Workflow’, id ‘{11111}’ for service ‘{1111}’ is still running, so the current instance will be skipped. Consider increasing the interval between jobs.

   OWSTIMER.EXE (0x133C) 0x08FC SharePoint Foundation Timer 5utp Verbose Scheduled timer job Workflow Failover, id {1111111}

  • Change maximum number of work items that can be obtained on a given query for work items that are scheduled to run.

       1. Stop the sptimerv4 service

       2. Run:

        stsadm -o setproperty -propertyname workitem-eventdelivery-throttle -propertyvalue 100

       3. Start the sptimerv4 service

      4. Restart the workflow timer job

      https://technet.microsoft.com/en-us/library/cc288491(v=office.12).aspx

  • Check if the Service account used for OWSTIMER is added into the following local policies on all the SharePoint servers
    1. Log on as a service
    2. Log on as a batch job

Additional information http://technet.microsoft.com/en-us/library/cc794944(WS.10).aspx

  • Clear the configuration cache

     (Get-SPDatabase | ? { $_.TypeName -eq “Configuration Database” }).RefreshCache()

  • On the SQL server execute the query EXEC sp_who2 – in order to identify if there are any SPIDs that are blocked

Additional information: http://sqlserverplanet.com/dba/using-sp_who2

  • Check if there are any items that are waiting to be processed

   SELECT DISTINCT [Type] FROM [content_db].[dbo].[ScheduledWorkItems]

  • If you identify any items that are waiting to be processed search for the ID in the dbo.Workflows table from SharePoint content database

    Remark: If you have Nintex workflows, there are not referenced in SharePoint workflow        database

  • Check the InternalState values of the workflows in dbo.Workflow table

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstate.aspx

  • You can run the following SQL query in SharePoint content database to list all workflow instances.

     SELECT AllLists.tp_Title as ListName,[ItemId],[ItemGUID],[Id] as WKFLinstanceID,[Modified],[Created],      [InternalState] FROM [Workflow] with (nolock)inner join AllLists on workflow.ListId =AllLists.tp_ID

  • To check if there are any orphaned workflow instance, you may use the following SQL to find out all workflow instances without a corresponding list item record:

     SELECT AllLists.tp_Title as ListName,[ItemId],[ItemGUID],[Id] as WKFLinstanceID,[Modified],[Created],      [InternalState] FROM [Workflow] with (nolock) inner join AllLists on workflow.ListId =AllLists.tp_ID          left join AllUserData on ItemGUID =AllUserData.tp_GUID where AllUserData .tp_GUID is null

Source of this article:

https://technet.microsoft.com/en-us/library/cc263148(v=office.14).aspx

http://blogs.technet.com/b/victorbutuza/archive/2009/02/26/how-to-enable-workflow-tracing-debug.aspx

http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/03/12/sharepoint-workflow-architecture-part-2.aspx