11 January 2008

Workflow "Failed on Start (retrying)"

Oh!! its SharePoint again :). One of these small things in this beast which makes you bang your head and pull your hear again and again if you don't get it right. Now lucky you you can search this issue and find the solution.

Debugging in SharePoint is very tricky sometimes because you get all of these levels to run around (GAC + IIS + Deployment Folder under the feature + Feature.xml + Workflow.xml + SharePoint itself + InfoPath the main form template + InfoPath the workflow forms and  Web Services) so after this, it is not strange that you would start pulling your hear after a while.

Problem Description:

if you try any workflow (including OOB WF and Custom WF) and when you try to start it, it will show the message Workflow "Failed on Start (retrying)". You may also see that some tasks in the WF are created and even so it fails.

Tip: whenever you are stuck with your custom workflow, try having the OOB, if it doesn't run, its not your problem. (i spent one complete day almost 20H just to discover its not my fault).

One Proof that this thing its not your custom code problem, if you attach the WF process to Visual Studio, it will not catch any exception.

Reasoning:

In WSS/MOSS the workflow engine will report back 'a workflow failed to start' even if the workflow did start.

The reason why is that - the workflow will be sent the 'OnWorkflowActivated' event (start command) and essentially as far as MOSS is concerned - it's starting.

When the workflow for e.g. writes a task item and then waits (handleExternal Event) for the OnTaskChanged event. At this point if it failed - a different error other than 'failed to start' would be reported.

Resolution:

  • First and importantly check all your correlation tokens. make sure that each task (Creation, Updating and Completing) has its own Token not the workflow token.
  • Then compare the dll you have with theone in the workflow.xml and the one in the GAC. simply they all should be the same.
  • Try this on the command prompt: Lodctr "c:\Windows\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\perfcounters.ini"
  • And if it doesn't work for you try: Lodctr /R "c:\Windows\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\perfcounters.ini"

Some Links might Help:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2268844&SiteID=1

Some errors you might see in logs:

  • The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.
  • Failed on Start (retrying).
  • Unexpected    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)...    
    01/11/2008 03:33:24.79*    w3wp.exe (0x12B4)                           0x0E9C    Windows SharePoint Services       Workflow Infrastructure
  • Unexpected    ...     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 ---     at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)     at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)     at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)     at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)     at System.Ac...    
    01/11/2008 03:33:24.79*    w3wp.exe (0x12B4)                           0x0E9C    Windows SharePoint Services       Workflow Infrastructure           72fu    Unexpected    ...tivator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)     at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.LoadPluggableClass(String classname, String assembly, Object[] parameters)    
    01/11/2008 03:33:24.80     w3wp.exe (0x12B4)                           0x0E9C    Windows SharePoint Services       Workflow Infrastructure
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Geek Lectures - Things geeks should know about » Blog Archive » Workflow “Failed on Start (retrying)” said:

PingBack from http://geeklectures.info/2008/01/10/workflow-failed-on-start-retrying/

10 January 08 at 9:28 PM
# MSDN Blog Postings » Workflow "Failed on Start (retrying)" said:

PingBack from http://msdnrss.thecoderblogs.com/2008/01/10/workflow-failed-on-start-retrying-4/

10 January 08 at 10:21 PM
# prudhvi said:

Am experiencing the problem "Failed on start (retrying)"

The only thing different is m getting this

"System.ArgumentException: Value does not fall within the expected range." when I peek into log.

Surprisingly, even after getting this error, my workflow continues to work and tasks are being created and completed as per my code. I just wanna get rid of this irritating "Failed.."

Here, you are talking about performance counters. What I am experiencing a little differenct.

Thanks in advance.

Here is log ->

72fs Unexpected RunWorkflow: System.ArgumentException: Value does not fall within the expected range.     at Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties..ctor(SPWorkflow workflow, Int32 runAsUserId, String associationData, String initiationData)     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.MakeActivation(SPWorkflow workflow, SPWorkflowEvent e)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflowElev(SPWorkflow originalWorkflow, SPWorkflow workflow, Collection`1 events, SPRunWorkflowOptions runOptions)

-Prudhvi

11 January 08 at 12:02 PM
# GildaShare said:

Thanks. Your blog made me solve this problem I was having since this morning. I was really becoming crazy.

so THANK YOU

Bye

Gildqa

24 April 08 at 12:59 PM
# EBI said:

what your idea about this exception in log

AutoStart Workflow: System.ArgumentException: New instances of this workflow template are currently disallowed.     at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflowElev(SPListItem item, SPFile file, SPWorkflowAssociation association, SPWorkflowEvent startEvent, Boolean bAutoStart, Boolean bCreateOnly)

please help me as soon as posible

mek027@yahoo.com

tanks in advance

28 June 08 at 3:19 AM
# peter said:

Hi, i receive the error "Failed on Start (retrying)" but only with some documents for another documents the same workflow start normally. The documents that present the error i terminate and start manually and continue receiving the error, wich is the solution for this scenario. I can't reasociate the workflow with the document library because the another instances of the workflow your status is waiting for approval and are much documents executing the workflow actually.

04 September 08 at 11:08 PM
# Anil said:

Today I attempted to take a workflow built with Visual Studio 2008 and move it to a WSPBuilder workflow. The reason I wanted to do this was because I had a nice Visual Studio solution for SharePoint already going utilizing WSPBuilder. Plus, the Visual Studio workflow solutions make it hard to deploy the association aspx pages easily without another web project.

Here are the details of the two solutions:

Solution 1 (original) - built with the Visual Studio 2008 SharePoint Sequential Workflow template

Solution 2 (new) - built with Visual Studio 2008 WSPBuilder.

So, to start I created a new sequential workflow in WSPBuilder and this built out my feature and initial workflow. Next, I created my aspx page in the layouts folder (this is the association page for my workflow). Next, I created the .cs page that will be the code behind for this aspx page. Now, this isn’t like a regular code behind because we aren’t in a web project and we are using SharePoint. This code behind will be in the GAC and the aspx page needs to reference it like this:

<%@ Page language=”C#” MasterPageFile=”~/_layouts/application.master”  

Inherits=”DocumentAssociationForm, DocumentApprovalWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5017f6ecf55b35e7″  %>

Notice my “Inherits” points to the assembly information and my MasterPageFile points to the application.master (because this page will live in the _layouts folder.

Now that I have my association pages built I needed to build out the workflow. I copied over the workflow I created in the original solution and placed it in the WorkflowCode folder (replacing the file that was put there by WSPBuilder when I created the workflow feature). Then I just made sure my feature.xml and elements.xml file were configured correctly to run this workflow. So, at this point I thought everything was ready to go. I used WSPBuilder to deploy my solution and I activated my feature on the site. I instantiated the workflow with my association data form I created and I was ready to test the workflow out. I went to run the workflow on an item in my list and I got this error: “Failed on Start (retrying)”. This made no sense to me because the same workflow worked fine from my original solution. So, was WSPBuilder causing the error? Did I mess up something? I really didn’t know. I then went to the SharePoint logs and found this error in them: “The workflow failed validation”.

Ah, my first clue. When a workflow fails validation, that usually means a .rules file is messed up. But, my .rules file seemed to be setup just fine. So, back to the drawing board.

After eliminating every possibility I went and took a look at the project files (.csproj) and I opened them up in notepad. I compared my new solutions file against my old solution and I noticed something. At the very end of the file on the original solution there was this line:

<Import Project=”$(MSBuildBinPath)\Microsoft.CSharp.targets” />

 <Import Project=”$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets” />

But, this was not in my new solution. So, it looks like the project file didn’t get notified to work with WF and version 3.5 specifically. I fixed the project file manually and everything worked.

Wow, that was a pain. But, in the end I have this workflow integrated into my larger solution so everything gets deployed at the same time. Thus, I don’t need a separate project just for my workflow and I don’t need a separate project just for my association form. It is really nice, but I almost put my head through the wall figuring it out.

27 September 08 at 11:02 AM
# Varadarajan said:

Fantastic solution !!!

It worked great when I changed the Correlation Token value to be unique.

Thanks!!!

25 December 08 at 1:52 PM
# Wael A. Kabli said:

Varadarajan ,

am glad it worked for you

25 December 08 at 11:02 PM
# Jill said:

This has been a issue for Us for Months... I Can not get this resolved can ANYOne Help?? Thanks

jill.willman@sagepub.com

06 January 09 at 2:20 PM
# Srinaath said:

You made my day....this point helped friend..

"Then compare the dll you have with theone in the workflow.xml and the one in the GAC. simply they all should be the same. "

12 February 09 at 1:13 PM
# netta said:

I'm having the the same problem but i can't figure out anything from the log - this is what im getting :

03/31/2009 13:20:10.34 w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     Engine RunWorkflow: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.  File name: 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'     at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)     at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)     at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)  ...

03/31/2009 13:20:10.34* w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     ...   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)     at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)     at System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)     at System.Reflection.Assembly.GetCustomAttributes(Boolean inherit...

03/31/2009 13:20:10.34* w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     ...)     at System.Workflow.Activities.Rules.RuleValidation.<LoadExtensionAttributeType>b__0(Assembly a)     at System.Array.ForEach[T](T[] array, Action`1 action)     at System.Workflow.Activities.Rules.RuleValidation.LoadExtensionAttributeType(Boolean loadAttributes)     at System.Workflow.Activities.Rules.RuleValidation..ctor(Activity activity, ITypeProvider typeProvider, Boolean checkStaticType)     at System.Workflow.Activities.Rules.RuleConditionReferenceValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.ValidationHelpers.ValidateObject(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.DependencyObjectValidator.ValidateDependencyProperty(DependencyObject dependencyObject, DependencyProperty depende...

03/31/2009 13:20:10.34* w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     ...ncyProperty, ValidationManager manager)     at System.Workflow.ComponentModel.Compiler.DependencyObjectValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.ActivityValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.CompositeActivityValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.Activities.IfElseBranchValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.ValidationHelpers.ValidateObject(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.ValidationHelpers.ValidateActivity(ValidationManager manager, Activity activity)     at System.Workflow.ComponentModel.Compiler.Compos...

03/31/2009 13:20:10.34* w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     ...iteActivityValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.Activities.IfElseValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.ValidationHelpers.ValidateObject(ValidationManager manager, Object obj)     at System.Workflow.ComponentModel.Compiler.ValidationHelpers.ValidateActivity(ValidationManager manager, Activity activity)     at System.Workflow.ComponentModel.Compiler.CompositeActivityValidator.Validate(ValidationManager manager, Object obj)     at System.Workflow.Runtime.WorkflowDefinitionDispenser.ValidateDefinition(Activity root, Boolean isNewType, ITypeProvider typeProvider)     at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity(Type workflowType, Boolean createDefinition, Boo...

03/31/2009 13:20:10.34* w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     ...lean initForRuntime)     at System.Workflow.Runtime.WorkflowDefinitionDispenser.GetRootActivity(Type workflowType, Boolean createNew, Boolean initForRuntime)     at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance)     at System.Workflow.Runtime.WorkflowRuntime.GetWorkflowExecutor(Guid instanceId, CreationContext context)     at System.Workflow.Runtime.WorkflowRuntime.InternalCreateWorkflow(CreationContext context, Guid instanceId)     at System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(Type workflowType, Dictionary`2 namedArgumentValues, Guid instanceI...

03/31/2009 13:20:10.34* w3wp.exe (0x0ECC)                       0x0F90 Windows SharePoint Services   Workflow Infrastructure       936l High     ...d)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.Send(SPWinOeWorkflow winoeworkflow, SPWorkflowEvent e)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(Guid trackingId, SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)    

any ideas ?

31 March 09 at 7:27 AM
# quang said:

This site have solve my problem. It talks about different url due to layout changes.

http://connectionstringexamples.com/article.php?story=Sharepoint-error-System-Argument

08 April 09 at 1:32 AM
# Raj said:

•Try this on the command prompt: Lodctr "c:\Windows\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\perfcounters.ini" worked for me.

you are a life saver. Thanks alot.

07 July 09 at 10:12 AM
# Carolina said:

I was also receiving Failed on start (retrying) for all workflows, ootb and spd. I did repair on .net framework from add/remove programs and that didn't work, i then did Lodctr /R "c:\Windows\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\perfcounters.ini" and that didn't work. Finally checked perfmon and saw the wwf was not part of ojects list. I tried again, but this time using  Lodctr "c:\Windows\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\perfcounters.ini"  and that FINALLY worked for me. Drop down list object appeared and all registry entries were there. Now no more failed on start errors.

thanks again!!!!

20 August 09 at 11:02 AM
# Denise Moura said:

I have the same error, but the file perfcounters.ini is not even in the informed path. Any info help be really appreciated.

15 September 09 at 4:15 PM
# Wael A. Kabli said:

Denise Moura,

did you ensure you have 3.5SP1?

15 September 09 at 6:23 PM
# Severin Dioulo said:

The way I resolved that issues was by removing all the commented out activity. I also replace the token. Possibly one of the commented out activity had some incorrect token.

22 September 09 at 10:26 AM
# Abhi said:

Thanks to Anil's Commments above...After wasting 10 hours...i finally found the remedy!

13 November 09 at 10:52 AM
# Damian said:

Can you help i have followed the information carolina used however when i run the locdir command without the R there is the following reponse

C:\>Lodctr "c:\Windows\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\

perfcounters.ini"

Unable to find initialization file c:\Windows\Microsoft.Net\Framework\v3.0\Windo

ws Workflow Foundation\perfcounters.ini

however with the R it says it was able to succesfully rebuild he performance conter.

what am i doing wrong????

18 November 09 at 7:51 AM

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker