Showing posts with label Memory Leak. Show all posts
Showing posts with label Memory Leak. Show all posts

Sunday, April 22, 2007

Find application with debug set to true using WinDbg

Actually I just found out about this about always set the debug configuration to false several months ago.
At that time we were having memory problems with our servers, asp.net worker process (aspnet_wp.exe) recycles very frequently (several times / day). Because our servers have a lots of applications, probably around 100+ applications (asp legacy + asp.net), and from our team, we only manage 2 applications at the servers (and very little information about who's the owner of the other applications), we decided to ask for M... (you know who) Support Team (MST) for help.
So we collected several dump files and sent them to the MST. The first advice we received from them was to set all the debug switch to false in the web.config for all applications, and they sent the list to us. Actually at that time, I was thinking, hhhmmm... is this possible? how can this relate to the memory problem? but in the end we followed the suggestion and we modified several hundreds of web.config files in the servers :P

For more information about this debug=true setting will cause, you can find in the Scott Guthrie's Blog : http://weblogs.asp.net/scottgu/archive/2006/04/11/Don_1920_t-run-production-ASP.NET-Applications-with-debug_3D001D20_true_1D20_-enabled.aspx

When i received the list of the applications which have debug set to true, i was kind of interested how they can get this information from the dump files, whether there's a command line for this, or they already have a script to run with the dump files. So i browsed and browsed the internet about this, and gradually i know a little bit about how to get process the dump files. But very unfortunate, i was not able to find out how to get the information about debug=true at that time, until several days ago where we got another server memory problem, so i have a chance a play around with the windbg again hehehe :P

So the steps are quite easy :
1. Load the dump files with windbg
2. Load the sos.dll (.load clr10\sos.dll)
3. Execute !FindDebugTrue
Hopla, it will list all the applications with debug set to true, quite simple rite :P
you can find more help information with !help command

Note : For a memory leak problem, there's a useful tool named Debug Diagnostic Tool from Microsoft, you can find more information in here : http://blogs.msdn.com/debugdiag/

Addition at 20071010 : You can find very good information regarding to the .Net memory debugging in Tess's Blog site (http://blogs.msdn.com/tess/default.aspx)