SharePoint User Group UK

Share the knowledge!

Welcome to SharePoint User Group UK Sign in | Join | Help
in
Home Blogs Forums Photos Files Roller

SharePoint Worklow Error in Logs - TrackedRequests?

Last post 09-08-2008, 3:47 PM by Cimares. 5 replies.
Sort Posts: Previous Next
  •  09-02-2008, 2:30 PM 13389

    SharePoint Worklow Error in Logs - TrackedRequests?

    Hi all,

    I have been developing workflows for some time now and have noticed that in the logs of my SharePoint server are many of the following errors:

    Unexpected ERROR: request not found in the TrackedRequests. We might be creating and closing webs on different threads. ThreadId = 30, Free call stack =    at Microsoft.SharePoint.SPRequestManager.Release(SPRequest request)     at Microsoft.SharePoint.SPSite.Close()     at Microsoft.SharePoint.SPSite.Dispose()     at MinorWFStateMachine_v1_1Test.Workflow1.<CheckDocumentsPOA_ExecuteCode>b__1()     at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)     at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()     at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     at Microsoft.SharePoint.SPSecurity.RunWi... 
    09/02/2008 13:24:34.45* OWSTIMER.EXE (0x0B4C)                    0x1AB4 Windows SharePoint Services    General                        0 Unexpected ...thElevatedPrivileges(CodeToRunElevated secureCode)     at MinorWFStateMachine_v1_1Test.Workflow1.CheckDocumentsPOA_ExecuteCode(Object sender, EventArgs e)     at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e)     at System.Workflow.Activities.CodeActivity.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.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)     at System.Workflow.Runtime.Scheduler.Run()     at System.Workflo... 

    Does anyone know what these mean? This particular one came up today but is for a workflow that is no longer used. I try to dispose variables wherever possible with 'using' statements.

    Thanks,

    Alex


    My New SharePoint Blog - http://sharepointcoding.wordpress.com

    MCP: Windows XP
  •  09-04-2008, 3:08 PM 13442 in reply to 13389

    Re: SharePoint Worklow Error in Logs - TrackedRequests?

    Hi Alex,

    Are you using SPSecurity.RunWithElevatedPrivileges?  Have you read Daniel Larson's blog about using SPUserToken instead http://daniellarson.spaces.live.com/Blog/cns!D3543C5837291E93!1919.entry.

    Another thought, which objects are you trying to dispose of?  The best practice of disposing objects in SharePoint http://msdn.microsoft.com/en-us/library/aa973248.aspx states you can't dipose of objects directly access via the current context.  For example:

    SPSite currentSite = SPControl.GetContextSite(Context);
    currentSite.Dispose();

    The code above currentSite.Dispose(); would cause issues with SharePoint.

    Hope this helps

    Dave


    My SharePoint Blog www.davehunter.co.uk/blog
  •  09-08-2008, 10:23 AM 13482 in reply to 13442

    Re: SharePoint Worklow Error in Logs - TrackedRequests?

    Hi Dave,

    I am using the SPSecurity.RunWithElevatedPrivileges, so I will have a look of using the SPUserToken instead. I have diposed the objects correctly I believe but I will double check my code.

    Thanks,

    Alex


    My New SharePoint Blog - http://sharepointcoding.wordpress.com

    MCP: Windows XP
  •  09-08-2008, 10:56 AM 13488 in reply to 13482

    Re: SharePoint Worklow Error in Logs - TrackedRequests?

    Alex,

    When you call the RunWithElevatedPriviledges, are you creating a new SPSite object? (As you should do for security.) Is it this that's getting disposed of in the wrong place perhaps?

    Paul.


    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
  •  09-08-2008, 11:22 AM 13491 in reply to 13488

    Re: SharePoint Worklow Error in Logs - TrackedRequests?

    Paul,

    This is one example of where I call the RunWithElevatedPrivaledges code:

    private void CheckDocumentsPOA_ExecuteCode(object sender, EventArgs e)

    {

    //Run the check with elevated security

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

    string ER;

    SPListItem item = workflowProperties.Item;

    ER = item["ER"].ToString();

    using (SPSite site = workflowProperties.Site)

    {

     

    using (SPWeb web = site.OpenWeb(ER))

    {

    SPList list = web.Lists["Purchase Order Data"];

    //Check if there is at least 1 item in the subsite

    if (list.Items.Count >= 1)

    {

    //Set our boolean variable to true

    hasDocumentsPOA = true;

    }

    else

    {

    //Set our boolean variable to false

    hasDocumentsPOA = false;

    }

    }

    }

    });

    }

     

    Cheers

    Alex


    My New SharePoint Blog - http://sharepointcoding.wordpress.com

    MCP: Windows XP
  •  09-08-2008, 3:47 PM 13498 in reply to 13491

    Re: SharePoint Worklow Error in Logs - TrackedRequests?

    Ok, well if whats happening as I think it is, then the problem could be the using statements around the new SPSite and SPWeb objects.

    Firstly, I found out the other day that if you're wrapping your SPSite in a using statement, and then using that to create an SPWeb, you don't need to dispose of the SPWeb as the using statement around SPSite will fix that.. so thats one less USING to worry about.

    The other thing is the source of workflowProperties.Site. I'm not 100% certain whether this object counts as coming from SPContext or not. If it is, then you don't want to dispose of it. Can anyone shed some light on this for us?

    Paul.


    www.myfatblog.co.uk
    MCTS: WSS 3.0
    MCTS: MOSS 2007
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems