1
Vote

Potentially excessive number of SPRequest objects error

description

I am getting this error when using the ECQWP. This did not occur in Development or Test but under load in Production we are seeing these errrors in the ULS logs.
 
I did find a possible similar issue around xsl style link [sheets|http://www.tech-archive.net/Archive/SharePoint/microsoft.public.sharepoint.windowsservices/2007-02/msg00073.html] but could not remove this error even with having inline XSL in the web part itself rather than an XSLLink like we currently have. The web part renders fine and just wanted to clean up the issue in the ULS logs as it could possibly be the reason our w3wp.exe process is consuming so much memory.
 
08/04/2009 14:28:57.95 w3wp.exe (0x0FF8) 0x0B70 Windows SharePoint Services General 0 Medium Potentially excessive number of SPRequest objects (9) currently unreleased on thread 29. Ensure that this object or its parent (such as an SPWeb or SPSite) is being properly disposed. Allocation Id for this object: {9410FF4D-9085-466B-AA39-19D272A2F412} Stack trace of current allocation: at Microsoft.SharePoint.SPRequestManager.Add(SPRequest request, Boolean shareable) at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) at Microsoft.SharePoint.SPWeb.InitializeSPRequest() at Microsoft.SharePoint.SPWeb.EnsureSPRequest() at Microsoft.SharePoint.SPWeb.get_Request() at Microsoft.SharePoint.SPWeb.SetMondoPr...
08/04/2009 14:28:57.95* w3wp.exe (0x0FF8) 0x0B70 Windows SharePoint Services General 0 Medium ...ocHint(Int32 hint) at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId, Int32 mondoHint) at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId) at CKS.EnhancedContentQueryWebPart.Wrappers.ListItemWrap..ctor(DataRow dr, SPSite site) at CKS.EnhancedContentQueryWebPart.ContentQueryWithContextMenus.EditDataRow(DataRow row, Int32 itemIndex) at CKS.EnhancedContentQueryWebPart.ContentQueryWithContextMenus.ProcessItems(DataTable dt) at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.IssueQuery() at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformSelect() ...
08/04/2009 14:28:57.95* w3wp.exe (0x0FF8) 0x0B70 Windows SharePoint Services General 0 Medium ... at Microsoft.SharePoint.WebPartPages.DataFormWebPart.DataBind() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.EnsureDataBound() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls() at CKS.EnhancedContentQueryWebPart.ContentQueryWithContextMenus.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean...
08/04/2009 14:28:57.95* w3wp.exe (0x0FF8) 0x0B70 Windows SharePoint Services General 0 Medium ... includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.ResumeSteps(Exception error) at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpRuntime.Pro...
08/04/2009 14:28:57.95* w3wp.exe (0x0FF8) 0x0B70 Windows SharePoint Services General 0 Medium ...cessRequestInternal(HttpWorkerRequest wr) at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr) at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)

comments

ishaisagi wrote Aug 5, 2009 at 2:09 AM

So I ran SPDisposeCheck and was very surprised (considering I didnt have the tool and I dont know how strict I was with it when I wrote it) that it had 0 found.

That said, I have researched about the error in question and the problem is that the web part does create a lot of SPRequests - it creates one for every single list item in the results (which is why I do not recommend using it, and which is why I wrote a different one for my current customer that works much faster)

When such a number is used, sharepoint will raise the alarm. The number can be tweaked, and is by default 8. This means that if you have a web part (or component - for example a custom navigation control that loads a lot of SPWeb objects) does more than 8 requests in each page load, you will get the warning. See http://msdn.microsoft.com/en-us/library/aa973248.aspx:

The best threshold varies according to the nature of your site and the applications running on it. When your sites are experiencing problems with performance, you should monitor your installation's ULS logs to understand how many SPRequest objects your site applications are creating. This helps you determine whether the designs of your sites and applications are creating too many SPRequest objects. Even if incorrect disposal of objects is not the cause of your performance problem, you might need to redesign your sites or custom site applications to reduce overall memory consumption caused by excessive proliferation of SPRequest objects.

Because the very low default threshold may not apply to many sites, you can change this threshold by editing the following registry subkey:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\HeapSettings

LocalSPRequestWarnCount = desired threshold value

ishaisagi wrote Aug 5, 2009 at 2:11 AM

Also, I found this article:http://www.tech-archive.net/Archive/SharePoint/microsoft.public.sharepoint.windowsservices/2007-02/msg00073.html that also blames the XSL.
It could be that if the XSL is invalid, the CQWP does not properly dispose of some objects. I would look into that if I were you

wrote Feb 14, 2013 at 6:11 PM