Saturday 27 March 2010

Mystery behind Failed on Start (Retrying)

Few days back i wanted to check the behavior of a out of the box (OOTB) document approval when there are multiple approvers in MOSS 2007. I thought the task is simple enough and was all geared up. I started one of my MOSS 2007 VPC’s and opened up a site which i had created earlier. I configured the OOTB approval workflow for a document library which was already available there. The approval workflow was configured to start on creation/updation of any item.
I wanted to test out the workflow. I uploaded a document into the library and hoping for the workflow to kick start. Little that i knew, i was in for a shock!!!
The workflow failed with the status Failed to Start (Retrying). (Refer the below picture)
mossworkflowfailedtostartstatus
This got me wondering what has gone wrong. I am using a OOTB workflow without any modifications, why does it give this error. The workflow log doesn’t help much to understand the problem. (Refer the below picture)
mossworkflowfailedtostartworkflowhistory
The next obvious place to check for diagnosing the issue was the SharePoint logs in 12 hive folder. On checking the logs, i found there where a few entries for Workflow Infrastructure category in the log. The error read like this…
Load Workflow Class: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.     at System.Diagnostics.PerformanceCounter.Initialize()     at System.Diagnostics.PerformanceCounter..ctor(String categoryName, String counterName, String instanceName, Boolean readOnly)     at System.Workflow.Runtime.PerformanceCounterManager.CreateCounters(String name)     at System.Workflow.Runtime.Hosting.DefaultWorkflowSchedulerService.OnStarted()     at System.Workflow.Runtime.Hosting.WorkflowRuntimeService.HandleStarted(Object source, WorkflowRuntimeEventArgs e)     at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at System.Workflow.Runtime.WorkflowRuntime.StartRuntime()     at Microsoft.SharePoint.Workflow.SPWinOeHostServices..ctor(SPSite site, SPWeb web, SPWorkflowManager manager, SPWorkflowEngine engine)     --- End of inner exception stack trace …..
This error was quite interesting to me. It looks like the OOTB workflow is creating some performance counters when the workflow starts and it is having some problems to create one thus giving an error Failed on Start.
When i was wondering why it was not able to find the performance counters, thanks to the blog post by Kiran really helped to figure out what’s going wrong. As pointed out in the blog post, there was some issue with the environment and for some reason Windows Workflow Foundation related performance counters were missing. This was basically creating the problem.
As directed in the blog post, I reinstalled .NET Framework 3.0 and associating performance counters with WF instances… Now the workflow was working properly… Wow!!!
However, I have absolutely no idea why those Performance counters went missing!!!
Technorati Tags: ,

No comments:

Post a Comment