Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a series of workflows (MOSS2007 SP2) that start each other in order using Useful SharePoint Designer Custom Workflow Activities - StartAnotherWorkflow. Occasionally the workflow dies and appears to die after starting the other workflow. The logs have the following error:

03/16/2010 11:28:59.44  w3wp.exe (0x15A4)                           0x1990  Windows SharePoint Services     General                         0   Unexpected  ERROR: request not found in the TrackedRequests. We might be creating and closing webs on different threads. ThreadId = 9, Free call stack =    at Microsoft.SharePoint.SPRequestManager.Release(SPRequest request)     at Microsoft.SharePoint.SPWeb.Invalidate()     at Microsoft.SharePoint.SPWeb.Close()     at Microsoft.SharePoint.SPSite.Close()     at Microsoft.SharePoint.SPSite.Dispose()     at Microsoft.SharePoint.Workflow.SPWorkflowManager.c__DisplayClass1.b__0()     at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)     at Microsoft.SharePoint.SPSecurity.c__DisplayClass4.b__2()     at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at Microsoft.SharePoint.SPSecurity.RunWithEl...  
03/16/2010 11:28:59.44* w3wp.exe (0x15A4)                           0x1990  Windows SharePoint Services     General                         0   Unexpected  ...evatedPrivileges(WaitCallback secureCode, Object param)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem item, SPWorkflowAssociation association, SPWorkflowEvent startEvent, Boolean bAutoStart, Boolean bCreateOnly)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem item, SPWorkflowAssociation association, String eventData, Boolean isAutoStart)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem item, SPWorkflowAssociation association, String eventData)     at DP.Sharepoint.Workflow.StartAnotherWorkflow.c__DisplayClass2.b__0()     at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object sta...   
03/16/2010 11:28:59.44* w3wp.exe (0x15A4)                           0x1990  Windows SharePoint Services     General                         0   Unexpected  ...te)     at Microsoft.SharePoint.SPSecurity.c__DisplayClass4.b__2()     at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)     at DP.Sharepoint.Workflow.StartAnotherWorkflow.Execute(ActivityExecutionContext executionContext)     at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)     at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)     at System.Workflow.ComponentModel.ActivityExecutorOpera...   
03/16/2010 11:28:59.44* w3wp.exe (0x15A4)                           0x1990  Windows SharePoint Services     General                         0   Unexpected  ...tion.Run(IWorkflowCoreRuntime workflowCoreRuntime)     at System.Workflow.Runtime.Scheduler.Run()     at System.Workflow.Runtime.WorkflowExecutor.RunScheduler()     at System.Workflow.Runtime.WorkflowExecutor.RunSome(Object ignored)     at System.Workflow.Runtime.Hosting.DefaultWorkflowSchedulerService.WorkItem.Invoke(WorkflowSchedulerService service)     at System.Workflow.Runtime.Hosting.DefaultWorkflowSchedulerService.QueueWorkerProcess(Object state)     at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)     at System.Threading.ExecutionContext.runTryCode(Object userData)     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)     at System.Threading.ExecutionContext.RunInt...   
03/16/2010 11:28:59.44* w3wp.exe (0x15A4)                           0x1990  Windows SharePoint Services     General                         0   Unexpected  ...ernal(ExecutionContext executionContext, ContextCallback callback, Object state)     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)  , Allocation call stack (if present) null     

Any ideas?

share|improve this question
    
Any other errors? Like SQL deadlocks in the log? –  Toni Frankola Mar 17 '10 at 17:01
    
Just the error that says "Thread was being aborted" followed by "Error loading and running event receiver Microsoft.SharePoint.Workflow.SPWinOEItemEventReceiver..." –  Mike Polen Mar 17 '10 at 17:09
1  
@Mike Polen: I've tried to improve the formatting here but if you think it's less clear please feel free to roll back. Thanks for your question and welcome to SharePoint Overflow! –  Alex Angas Mar 18 '10 at 0:25
    
Thanks, the format helps –  Mike Polen Mar 18 '10 at 13:11
add comment

3 Answers

It looks like your requests are getting stored in some kind of cache\session\etc - line 1: request not found in the TrackedRequests.

If a Response.End() is being called (either directly, or via Response.Redirect), it will throw a ThreadAbortException - which would abort the thread, moving the rest of the requests to a new thread. If the new thread can't access 'TrackedRequests,' which could be a cache on the old thread, then it would make sense that this would be called.

Are these workflows something you've written that have a Respone.Redirect or Server.Transfer somewhere?

The other possibility may lie in the Web.Dispose() that's being called. If the web gets closed, and the thread is trying to access something in the web, that would throw an exception, although that would probably be a null reference exception. My money is on a thread abort, either through worker process recycling or a response.end.

Hope this helps,

John

Actually, I did some more research, it looks like it's related to disposal of objects properly:

http://stackoverflow.com/questions/2021033/investigating-the-root-cause-behind-sharepoints-request-not-found-in-the-tracke

http://www.muhimbi.com/blog/2009/07/solution-for-sharepoints-common.html

The non-disposed web & site objects led me down this path at first, but thread aborting is something I've seen a lot of with ending responses. Also, you may want to try SPUserToken vs. RunWithElevatedPrivileges, referenced in first link above. If security is crossing threads (i.e., opening some webs as user, some elevated), that may lead to some issues.

share|improve this answer
    
No, this isn't it. There are no Reponse.End calls. We are redesigning the system to be less complex. I think the actual issue was a corrupt DLL. –  Mike Polen Jun 2 '10 at 23:54
add comment

I copied in some code from Useful SharePoint Designer Custom Workflow Activities - StartAnotherWorkflow below.

I am not familiar with this tool, but first thing to do is to confirm that this code works on your environment, using a test scenario that is as basic as possible.

So, have one workflow which starts another workflow, and let each workflow log it's start and finish.

Try both autostart and manual start for the first workflow, and confirm both methods work.

Please come back with your test results.

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
    try
    {
        //need to run under SHAREPOINT\system account because
        //workflow owner might not have start workflow permissions on the target list
        SPSecurity.RunWithElevatedPrivileges(delegate
         {
             using (SPSite site = new SPSite(__Context.Site.ID))
             {
                 using (SPWeb web = site.AllWebs[__Context.Web.ID])
                 {
                     SPList list = web.Lists[new Guid(ListId)];

                     SPListItem listItem =
                         list.Items.GetItemById(ListItem);

                     //resolve any lookup parameters
                     string wkId =
                         Common.ProcessStringField(executionContext,
                                                   WorkflowIdentifier);

                     //find workflow association by name
                     SPWorkflowAssociation myWorkflowAssoc =
                         list.WorkflowAssociations.GetAssociationByName(
                             wkId, Thread.CurrentThread.CurrentCulture);

                     if (myWorkflowAssoc != null)
                     {
                         //start the workflow
                         site.WorkflowManager.StartWorkflow(
                            listItem,
                            myWorkflowAssoc,
                            myWorkflowAssoc.AssociationData);
                     }
                 }
             }
         });
    }
    catch (Exception e)
    {
        Common.LogExceptionToWorkflowHistory(e, executionContext, WorkflowInstanceId);

        throw;
    }

    return ActivityExecutionStatus.Closed;
}
share|improve this answer
2  
We are redesigning the system to be less complex, but I think the actual issue was a corrupt DLL. –  Mike Polen Jun 2 '10 at 23:55
add comment

I have a blog post on this issue - Disposing of SharePoint Variables

Hope this helps,

Cheers,

Alex

share|improve this answer
    
I don't think this is the problem. The code for StartAnotherWorkflow can be found here: spdactivities.codeplex.com/SourceControl/changeset/view/… It looks correct to me. –  Mike Polen Mar 19 '10 at 12:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.