Saturday, June 22, 2013

Question : Memory Leak :Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationModeauthenticationMode)

In our uls logs , we are getting message :

Process : OWSTIMER.EXE (_x-_-_)
Thread ID : _x_-_-
Area : SharePoint Foundation
Category : Performance
Event ID : n-_-
Level : Unexpected

Message :

An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. Due to flags specified at object creation, this will not be freed until processed by garbage collection. Allocation Id: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} This SPRequest was allocated at at Microsoft.SharePoint.Library.SPRequest..ctor() at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) at Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationMode authenticationMode) at Microsoft.SharePoint.Administration.SPGlobalAdmin.get_ServerLanguage() at Microsoft.SharePoint.Administration.SPSqmTimerJobDefinition.Execute(Guid targetInstanceId) at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result) at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result)



Please help us identify the root cause and resolution for this .

We have also updated SPWebService.CollectSPRequestAllocationCallStacks property
A similar one

A similar one :

Process : w3wp.exe (_x-_-_)
Thread ID : _x-_-_
Area : SharePoint Foundation
Category : Performance
Event ID : f-_-
Level : High

Message :

An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. This object will now be disposed. Allocation Id: {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx} This SPRequest was allocated at at Microsoft.SharePoint.Library.SPRequest..ctor() at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) at Microsoft.SharePoint.SPWeb.InitializeSPRequest() at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId, Int32 mondoHint) at Microsoft.SharePoint.SPFeatureManager.EnsureSiteAndWeb(SPUrlZone zone, Guid databaseid, Guid siteid, Guid webid, SPSite& site, SPWeb& web) at Microsoft.SharePoint.SPFeatureManager.<>c__DisplayClass25.b__24() at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param) at Microsoft.SharePoint.SPFeatureManager.GetAllFeatureListTemplates(Byte[]& userToken, Guid& tranLockerId, Int32 nZone, Guid databaseid, Guid siteid, Guid webid, String& sxmlListTemplatesXml) at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListTemplates(String bstrUrl, ISP2DSafeArrayWriter pTemplateData) at Microsoft.SharePoint.Library.SPRequest.GetListTemplates(String bstrUrl, ISP2DSafeArrayWriter pTemplateData) at Microsoft.SharePointSPListTemplateCollection.InitTemplates() at Microsoft.SharePoint.SPWeb.get_ListTemplates() at Microsoft.SharePoint.SoapServer.SiteDataImpl.GetListXml(XmlTextWriter w, SPWeb spWeb, SPList spList, Boolean ignoreSecurityIfInherit, Int32 schemaVersion) at Microsoft.SharePoint.SoapServer.CListChange.WriteChanges(XmlTextWriter w) at Microsoft.SharePoint.SoapServer.CChange.WriteChildren(XmlTextWriter w) at Microsoft.SharePoint.SoapServer.CWebChange.WriteChanges(XmlTextWriter w) at Microsoft.SharePoint.SoapServer.CChange.WriteChildren(XmlTextWriter w) at Microsoft.SharePoint.SoapServer.CSiteChange.WriteChanges(XmlTextWriter w) at Microsoft.SharePoint.SoapServer.SiteDataImpl.GetChanges(ObjectType objectType, String contentDatabaseId, String& startChangeId, String& endChangeId, Int64 maxChangesToFetch, UInt32 maxSPRequests, Boolean getMetadata, Boolean ignoreSecurityIfInherit, Int32 schemaVersion, Boolean& moreChanges) at Microsoft.SharePoint.SoapServer.SiteDataImpl.HandleChangesEx(String xmlInput) at Microsoft.SharePoint.SoapServer.SiteDataImpl.GetChangesEx(Int32 version, String xmlInput) at Microsoft.SharePoint.SoapServer.SiteData.GetChangesEx(Int32 version, String xmlInput) at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values) at System.Web.Services.Protocols.WebServiceHandler.Invoke() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() at System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context) at System.Web.Script.Services.ScriptHandlerFactory.HandlerWrapper.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.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)

1 comment:

  1. You'll see this in your logs when you have custom code deployed that was built without using SharePoint development best practices. There are several objects in the SP development that need to be disposed of, like SPWeb and SPSite.

    Check these links:

    Here are the best practices document from Microsoft:
    http://msdn.microsoft.com/en-us/library/aa973248.aspx

    Here is the SharePoint Dispose Checker tool to help you to find the problem in your custom code:
    http://code.msdn.microsoft.com/SPDisposeCheck

    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

    ReplyDelete