<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx</link><description>In an earlier article I have discussed that all SPSite and SPWeb (and potentially also PublishingWeb) objects need to be properly disposed to avoid memory pressure situations. Roger Lamb has a nice summary of coding patterns which will actually cause</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3345289</link><pubDate>Tue, 20 Jul 2010 08:43:24 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3345289</guid><dc:creator>Stefan Goßner</dc:creator><description>&lt;p&gt;Hi Ali,&lt;/p&gt;
&lt;p&gt;not every memory leak is related to SPWeb or SPSite. A detailed analysis of the memory pattern might be required to track this down. Also ensure to be on the latest SharePoint patch level to ensure that you are not running into an already fixed problem in the product.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3345289" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3345019</link><pubDate>Mon, 19 Jul 2010 16:44:06 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3345019</guid><dc:creator>Ali</dc:creator><description>&lt;p&gt;Thanks for your reply Stefan. The settings did take place as per your suggestion but I am not able to remove the memory leaks error, not sure what is causing it as all my codes are properly disposing SPSite and SPWeb objetcs. Is there anything you think I should see ti improve the memory leakage errors. Also I increased the threshold to 150 in the registry key as per your recommendation to play with the threshold, but still no resolute.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3345019" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3344952</link><pubDate>Mon, 19 Jul 2010 08:56:31 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3344952</guid><dc:creator>Stefan Goßner</dc:creator><description>&lt;p&gt;Hi Ali,&lt;/p&gt;
&lt;p&gt;after creating the key you need to do an IISRESET or restart the application pool to ensure that the setting takes effect.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3344952" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3344530</link><pubDate>Thu, 15 Jul 2010 22:38:50 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3344530</guid><dc:creator>Ali</dc:creator><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;I have a local intranet site that has approximately 2000 users. We have a custom web part deployed at the homepage of our site and people have complained that the web part disappears sometimes, it can be brought back by refreshing the page. The web part has caching enabled and we tested it at our Dev and QA servers and can not reproduce the same error.&lt;/p&gt;
&lt;p&gt;I checked the ULS logs of our production enviornment and see the following errors with high priority:&lt;/p&gt;
&lt;p&gt;An SPRequest object was not disposed before the end of this thread. &amp;nbsp;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. &amp;nbsp;This object will now be disposed. &amp;nbsp;Allocation Id: &amp;nbsp;{31C1D221-691D-4D95-839E-CFE855F7B114} To determine where this object was allocated, create a registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\HeapSettings. Then create a new DWORD named SPRequestStackTrace with the value 1 under this key.&lt;/p&gt;
&lt;p&gt;I tried creating a key as per their suggestion thinking I would be pinpointed to the appropriate DLL/Method. That was not very helpful.&lt;/p&gt;
&lt;p&gt;I tried using Microsft SharePoint Memory Dispose Checker and thought it would resolve my problem and found 2 methods (not the same web part with caching) in my solution not disposing memory as per the best practices. I fixed them both and the results slighly improvised. I googled your blog and increased the threshold value of SPRequests. That again did thin down the errors, however I still have some errors coming up. My first guess to my web part caching problem would be to remove all these errors as that may burden the server.&lt;/p&gt;
&lt;p&gt;I am sure there are no other codes that are not disposing memory as per the best practise. What am I missing? Why am I not able to reproduce the same web part error on my Dev and QA boxes? Why am I still getting the errors in my ULS Logs??&lt;/p&gt;
&lt;p&gt;Thoughts??&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3344530" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3299119</link><pubDate>Tue, 08 Dec 2009 12:27:49 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3299119</guid><dc:creator>Stefan Goßner</dc:creator><description>&lt;p&gt;Hi Jane,&lt;/p&gt;
&lt;p&gt;it does not matter if this is in C#, VB.NET or powershell.&lt;/p&gt;
&lt;p&gt;You always have to dispose these objects.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3299119" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3299118</link><pubDate>Tue, 08 Dec 2009 12:23:32 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3299118</guid><dc:creator>Jane Barrister</dc:creator><description>&lt;p&gt;How does this apply to SharePoint 2010 and PowerShell with objects like SPSite, SPWeb, etc. Are there any best practices as to use this objecct and &amp;nbsp;loop through them in PowerShell?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3299118" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3293599</link><pubDate>Fri, 13 Nov 2009 10:35:05 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3293599</guid><dc:creator>Stefan Goßner</dc:creator><description>&lt;p&gt;Hi Subhasis,&lt;/p&gt;
&lt;p&gt;this is expected and by design. During crawl the same happens as if you would browse to the website. Except that crawl puts a pretty high load on the site. Every single instantiated SPWeb objects maintains its own SQL connection. As the crawler uses multiple threads to crawl the site it is like a load test against your site. All the navigation controls on the pages will get instantiated and will instantiate SPWeb objects.&lt;/p&gt;
&lt;p&gt;So the only way to reduce the number of SQL connections would be to reduce the number of threads the crawler is using.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3293599" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3293596</link><pubDate>Fri, 13 Nov 2009 10:20:02 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3293596</guid><dc:creator>Subhasis</dc:creator><description>&lt;p&gt;I have a strange error here.I have a content source. Whenever crawl runs,SQL connections goes too high. and only thing i got in the ULS logs is below&lt;/p&gt;
&lt;p&gt;Potentially excessive number of SPRequest objects (12) currently unreleased on thread 9. &amp;nbsp;Ensure that this object or its parent (such as an SPWeb or SPSite) is being properly disposed. &amp;nbsp;Allocation Id for this object: {329BFC8D-6CB9-4C18-8048-72166ABE4E08} Stack trace of current allocation: &amp;nbsp; &amp;nbsp;at Microsoft.SharePoint.SPRequestManager.Add(SPRequest request, Boolean shareable) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SPWeb.InitializeSPRequest() &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SPWeb.EnsureSPRequest() &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SPWeb.get_Request() &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SPWeb.SetMondoPr...	 &lt;/p&gt;
&lt;p&gt; 	...ocHint(Int32 hint) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId, Int32 mondoHint) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.CWebChange.CheckDB() &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.CWebChange..ctor(CChange parentChange, String strID, Boolean fDeleteEvent) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.CSiteChange.GetWeb(String strID, Boolean fDeleteEvent) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.SiteDataImpl.ProcessChanges(CChange change, SPChangeCollection spChangeCollection, SPChangeToken&amp;amp; spLastChangeToken, Int64&amp;amp; lTimeLeft) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.SiteDataImpl.GetChanges(CChange change, SPChangeToken&amp;amp; spChangeToken_Start, SPChangeToken spChangeToken_End, Int64 lTimeout) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.SiteDataImpl.GetChanges(ObjectType objectType, String contentDa...	 &lt;/p&gt;
&lt;p&gt;1...tabaseId, String&amp;amp; startChangeId, String&amp;amp; endChangeId, Int32 Timeout, Boolean&amp;amp; moreChanges) &amp;nbsp; &amp;nbsp; at Microsoft.SharePoint.SoapServer.SiteData.GetChanges(ObjectType objectType, String contentDatabaseId, String&amp;amp; LastChangeId, String&amp;amp; CurrentChangeId, Int32 Timeout, Boolean&amp;amp; moreChanges) &amp;nbsp; &amp;nbsp; at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp;amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) &amp;nbsp; &amp;nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) &amp;nbsp; &amp;nbsp; at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) &amp;nbsp; &amp;nbsp; at System.Web.Services...	 	Windows SharePoint Services &amp;nbsp; 	General &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 	0	Medium &amp;nbsp;	....Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values) &amp;nbsp; &amp;nbsp; at System.Web.Services.Protocols.WebServiceHandler.Invoke() &amp;nbsp; &amp;nbsp; at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() &amp;nbsp; &amp;nbsp; at System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context) &amp;nbsp; &amp;nbsp; at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() &amp;nbsp; &amp;nbsp; at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; completedSynchronously) &amp;nbsp; &amp;nbsp; at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error) &amp;nbsp; &amp;nbsp; at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) &amp;nbsp; &amp;nbsp; at System.Web.HttpRuntime.ProcessRequestInternal(HttpWo...	 &lt;/p&gt;
&lt;p&gt;...rkerRequest wr) &amp;nbsp; &amp;nbsp; at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)&lt;/p&gt;
&lt;p&gt;Looks like the same error. But it happnes with crawl ? Any pointers. we have custom webparts. But RendertoIndexer property is already set to false. So webparts are not loaded during crawl. So what might be the reason of such high number of SP Requests ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3293596" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3291625</link><pubDate>Thu, 05 Nov 2009 08:21:50 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3291625</guid><dc:creator>Stefan Goßner</dc:creator><description>&lt;p&gt;Hi Cornelius,&lt;/p&gt;
&lt;p&gt;I have never seen this.&lt;/p&gt;
&lt;p&gt;But the error indicates that you entered the registry value with the incorrect type. Did you use DWORD or string?&lt;/p&gt;
&lt;p&gt;It should be a DWORD.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3291625" width="1" height="1"&gt;</description></item><item><title>re: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007</title><link>http://blogs.technet.com/b/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx#3291505</link><pubDate>Wed, 04 Nov 2009 19:31:30 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3291505</guid><dc:creator>Cornelius J. van Dyk</dc:creator><description>&lt;p&gt;Hey Stefan,&lt;/p&gt;
&lt;p&gt;We implemented your recommended changed on our QA SharePoint WFE server and then the WFE started throwing the following error for some unknown reason:&lt;/p&gt;
&lt;p&gt;Server Error in '/' Application.&lt;/p&gt;
&lt;p&gt;--------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;Specified cast is not valid. &lt;/p&gt;
&lt;p&gt;Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;/p&gt;
&lt;p&gt;Exception Details: System.InvalidCastException: Specified cast is not valid.&lt;/p&gt;
&lt;p&gt;Source Error: &lt;/p&gt;
&lt;p&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Stack Trace: &lt;/p&gt;
&lt;p&gt;[InvalidCastException: Specified cast is not valid.]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.SPRequestManager.get_SPRequestsPerThreadWarning() +588&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.SPRequestManager.Add(SPRequest request, Boolean shareable) +695&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) +2626&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationMode authenticationMode) +192&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.Administration.SPFarm.get_RequestNoAuth() +25&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler.get_Hash() +162&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler.get_AppDomainIdHeader() +152&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler.OverrideExecuteUrlPath() +507&lt;/p&gt;
&lt;p&gt; &amp;nbsp; System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +83&lt;/p&gt;
&lt;p&gt; &amp;nbsp; System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8677954&lt;/p&gt;
&lt;p&gt; &amp;nbsp; System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; completedSynchronously) +155&lt;/p&gt;
&lt;p&gt;--------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082 &lt;/p&gt;
&lt;p&gt;The only way to get the WFE back online was to removed the registry entries and restart the services.&lt;/p&gt;
&lt;p&gt;Researching the particular error yielded nothing except one Google cached paged that had the same problem on 9/29/09.&lt;/p&gt;
&lt;p&gt;Do you have any ideas what might have caused the server to behave like that? (I'm not expecting you to miraculously know or be able to resolve the problem, but I'm hoping you might have seen a server do that before when applying these entries)&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;C&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3291505" width="1" height="1"&gt;</description></item></channel></rss>