PortalSiteMapProvider causing excessive SPRequest objects

3.3k views Asked by At

We have a custom navigation webpart that uses the PortalSiteMapProvider of MOSS to build a menu navigation. It seems that the Provider is not managing it's objects. Any idea on how to manage the objects that are being created in the Provider?

It is causing log errors like so:

Potentially excessive number of SPRequest objects (9) currently unreleased on thread 1. Ensure that this object or its parent (such as an SPWeb or SPSite) is being properly disposed. Allocation Id for this object: {56D66DBA-AE72-42DF-A70F-B45E05A60A08} 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.InitWebPublic()
at Microsoft.SharePoint.SPWeb.get_Exists()
at Microsoft.SharePoint.Publishing.CachedObjectFactory.CreateWebFromUrl(String url)
at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode..ctor(PortalWebSiteMapNode webNode, SPNavigationNode node, PortalSiteMapNode parentNode, NodeTypes type, String url, String title, String description)
at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.CreateSPNavigationSiteMapNode(PortalWebSiteMapNode webNode, SPNavigationNode node, PortalSiteMapNode parentNode)
at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.ProcessSPNavigationNode(SPNavigationNode node, SPNavigationNode previousSibling, PortalSiteMapNode parentNode)
at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMap.Node.PopulateNavigationChildren()
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode node, NodeTypes includedHiddenTypes)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(SiteMapNode node)
at System.Web.SiteMapNode.get_ChildNodes()
at Microsoft.SharePoint.Publishing.Navigation.PortalHierarchicalEnumerable.System.Collections.IEnumerable.GetEnumerator()
at System.Web.UI.WebControls.Menu.DataBindRecursive(MenuItem node, IHierarchicalEnumerable enumerable)
at System.Web.UI.WebControls.Menu.DataBindRecursive(MenuItem node, IHierarchicalEnumerable enumerable)
at System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item)
at System.Web.UI.WebControls.Menu.PerformDataBinding()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.Menu.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.Menu.EnsureDataBound()
at System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)
at System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript)
at System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e)
at Microsoft.SharePoint.WebControls.AspMenu.OnPreRender(EventArgs e)
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.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.VIEWPAGE_ASPX_2077083467.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.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpCont

1

There are 1 answers

0
Nat On BEST ANSWER

Stefan Goßner's blog post seems to answer the question. The issue is not that the SPWeb objects are not being closed, but that once a certain threshold (defaults to 8) of allocations are hit, the warning is created in the log. Depending on your site structure the number that will be created will vary. Given the nested nature of navigation, the objects are kept open while the sub tree is traversed. So the objects are correctly disposed of, it is just that more than 8 (by default) are being held open at a given time.

See this question