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)

3 comments:

plem44 said...

When I tried to run the !finddebugtrue I got an error that said "doesn't worj with 2.x" and I used the clr10/sos.dll, any suggestions

Bembeng Arifin said...

Hi plem44,

Sorry for the late reply ;)
This sos.dll is for .net 1.1 version.
For .Net 2.0 dumps, you will need to load the sos.dll from the Framework 2.0 directory
.load C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\sos.dll
Good luck :)

plem44 said...

After more review it appears that the command !finddebugtrue was cut from the .net 2.0 sos.dll, we have been working with Microsoft support on some IIS issues using adplus -hang -iis and we send the .dmp fil results to Microsoft. They replied with a list of !finddebugtrue and showed the command !finddebugtrue - I Microsoft we were unable to use the !finddebugtrue in our sos.dll and they said it was removed and the version they have is not for public use. This would be such a great thing if someone could get a copy of that sos.dll

Thanks

Post a Comment