3
What is a Crash (technically)... in ASP.NET and what to do if it happens? 7 imRahulSoni 1 Mar 2006 8:15 PM Many times while troubleshooting performance related issues in ASP.NET/IIS we find that customers come in saying that the ASP.NET process crashes n number of times a day, two or more. Now, the question arises, that is it really a crash, or some Yellow color error message (or a plain "Page cannot be displayed" error) which is shown on the client's browser? Well, as they say, everything that glitters is not gold. On similar grounds, every error thrown on the browser is not a crash. We need to keep multiple things in mind depending on what exactly could have caused the error, and before we decide to call it a crash, we should know what *exactly* is a crash! In the forthcoming series under "Performance" category of my blog, I will discuss basics of CRASH, HANG, HIGH CPU, HIGH MEMORY, DEADLOCK and OUT OF MEMORY issues. Symptoms Prior to IIS6, when a crash happened it brought the down the IIS and the connections remained open. So the client browsers typcially see a disconnected connection and shows "Page cannot be found" or some similar error. Now, in IIS6 Worker Process Isolation Mode, HTTP.SYS takes care of the connections in the kernelmode itself. So even if w3wp.exe crashes for some reason, the connection remains and IIS spawns a new process to handle future requests. Eventually, client browsers will not show "Page cannot be found" error. But, any unsent response from the server will be lost. If you open your Event Viewer you should find a similar Error entry in the Application log. Event Type: Error Event Source: ASP.NET 1.1.4322.0 Event Category: None Event ID: 1000 < CRASH Date: 2/8/2006 Time: 4:45:23 AM User: N/A Computer: RAHULSONI Description: aspnet_wp.exe (PID: 956) stopped unexpectedly. Or A process serving application pool '<The Application Pool Name>' suffered a fatal communication error. Or Faulting application w3wp.exe, version 6.0.3790.1830, faulting module <module name>, version <some version number>, fault address <some address>. Or Faulting application w3wp.exe, version 6.0.3790.1830, faulting module <module name>, version <some version number>, fault address <some address>. Why does it happen? Well, it depends! But to give you a brief idea, it could simply be many things, like... "Stack Overflow", "Access Violation", "A *bad* dll", "A *bad* filter", etc etc etc. The bottom line is that, ASP.NET *crashed* because something really bad happened and it found it impossible to continue. BUT... believe me, there are reasons to it, and more often than not, we can fix it! What to do? When something goes wrong while coding, we DEBUG... "LIVE". When something goes wrong in your production box, we DEBUG... but this time we do it after the issue has happened. It is called PostProduction debugging. For that, we typically require a set of memory dump (it is nothing but a memory snapshot of the ASPNET_WP.exe or W3Wp.exe which is captured when the issue happens). In a *CRASH* scenario, since it happens automatically we must do something which captures the data as soon as the issue manifests itself again. 1) As you may guess, We need a tool to capture the memory dumps. Lets visit the follwing link... http://www.microsoft.com/windowsserver2003/iis/diagnostictools/default.mspx 2) You need to download IIS Diagnostics Toolkit depending on your OS version 3) Install the software on your production box and rest assured, since the install doesn't require any reboot. 4) Open Debug Diagnostics Tool 1.0 (Start > All Programs > IIS Diagnostics (32bit) > Debug Diagnostics Tool) 5) On the Rules tab, click "Add Rule" 6) Select "Crash" option and click "Next" 7) Select "All IIS Processes" option and click "Next" 8) Under "Advanced Settings", click "Breakpoints" 9) Click "Add Breakpoint" 10) Select "KERNEL32!ExitProcess" in the "Offset Expression" list. 11) Change "Action Type" to "Full UserDump" 12) Click "Add Breakpoint" 13) Select "Kernel32!TerminateProcess" in the "Offset Expression" list. 14) Change "Action Type" to "Full UserDump" 15) Click "Save and Close"

What is a Crash (Technically)... in ASP

Embed Size (px)

DESCRIPTION

sdsds

Citation preview

  • 5/9/2015 What is a Crash (technically)... in ASP.NET and what to do if it happens? - Rahul Soni's blog - Site Home - MSDN Blogs

    http://blogs.msdn.com/b/rahulso/archive/2006/03/02/what-is-a-crash-technically-in-asp-net-and-what-to-do-if-it-happens.aspx 1/3

    What is a Crash (technically)... in ASP.NET and what to do if it happens?7imRahulSoni 1 Mar 2006 8:15 PM

    ManytimeswhiletroubleshootingperformancerelatedissuesinASP.NET/IISwefindthatcustomerscomeinsayingthattheASP.NETprocesscrashesnnumberoftimesaday,twoormore.Now,thequestionarises,thatisitreallyacrash,orsomeYellowcolorerrormessage(oraplain"Pagecannotbedisplayed"error)whichisshownontheclient'sbrowser?Well,astheysay,everythingthatglittersisnotgold.Onsimilargrounds,everyerrorthrownonthebrowserisnotacrash.Weneedtokeepmultiplethingsinminddependingonwhatexactlycouldhavecausedtheerror,andbeforewedecidetocallitacrash,weshouldknowwhat*exactly*isacrash!Intheforthcomingseriesunder"Performance"categoryofmyblog,IwilldiscussbasicsofCRASH,HANG,HIGHCPU,HIGHMEMORY,DEADLOCKandOUTOFMEMORYissues.

    SymptomsPriortoIIS6,whenacrashhappeneditbroughtthedowntheIISandtheconnectionsremainedopen.Sotheclientbrowserstypciallyseeadisconnectedconnectionandshows"Pagecannotbefound"orsomesimilarerror.

    Now,inIIS6WorkerProcessIsolationMode,HTTP.SYStakescareoftheconnectionsinthekernelmodeitself.Soevenifw3wp.execrashesforsomereason,theconnectionremainsandIISspawnsanewprocesstohandlefuturerequests.Eventually,clientbrowserswillnotshow"Pagecannotbefound"error.But,anyunsentresponsefromtheserverwillbelost.

    IfyouopenyourEventVieweryoushouldfindasimilarErrorentryintheApplicationlog.

    EventType:ErrorEventSource:ASP.NET1.1.4322.0EventCategory:NoneEventID:1000

  • 5/9/2015 What is a Crash (technically)... in ASP.NET and what to do if it happens? - Rahul Soni's blog - Site Home - MSDN Blogs

    http://blogs.msdn.com/b/rahulso/archive/2006/03/02/what-is-a-crash-technically-in-asp-net-and-what-to-do-if-it-happens.aspx 2/3

    16)Click"Next","Next"and"Finish"17)EnsurethatthestatusDebugDiagnostictoolsays,"Active"

    18)Waitfortheissuetooccur.19)Iftheissuehappensagain,youshouldbereadywithadump.TheUserdumpPathinthescreenshotabovewillshowyouthepathwherethedumpfilesaregenerated.20)Now,themajorpartofcollectingthedumpisdone.Toanalyzeit,gototheDebugDiagnosticToolonceagain,andclick"AdvancedAnalysis"tab.21)Click"AddDataFiles"andbrowsetothedumpfile(.dmpextension,intheformataspnet_wp__PIDxxxxxxxx.dmporw3wp__PID__2716xxxxxxxx.dmp)22)Inthe"AvailableAnalysisScripts"selectCrash/HangAnalyzersandclick"StartAnalysis"23)Itmighttakesometimetoanalyzeyourdumpfile,sincethetoolwilltrytodownloadsymbols(moreonthislater)fromtheinternet.24)Oncetheanalysisiscompleteitwillcreatea.mhtfileandopenabrowserautomaticallyshowingtheanalysis.25)Youmighttakealookintothereportandifyouarefortunateenough,youwillfindtheissuerightaway!!

    Intheothercase,pleasevisitthefollowinglinkandchooseappropriatesupportoptionsuitedtoyourneed.Wewillbemorethanhappytoassistyou!http://www.microsoft.com/services/microsoftservices/srv_support.mspx

    Hopethathelps!

    DebugDiagCrash.GIFComments

    Sean Gahan 2 Mar 2006 12:04 PMRahul, Thank you for the info; I found it very informative. I have a question though it is a little offtopic. I use VS2003 along with Source Safe and ASP.NET does this thing that is very annoying;whenever I switch the aspx page from html to design and the page is under source control, Iam prompted to check out the page. If the Source Safe checkout prompt only happened everyonce and a while that would be one thing, but since it happens dozens of times a day it hasbecome very annoying. While I am complaining, I have one more issue. Occasionally when Iam using the design view for a page the cursor/mouse will get stuck in a part of the page.Kind of like the mouse gets stuck inside a table and you can only move inside the area of thetable; that one is annoying too. Anyway, thanks for your post I found it useful, as well as yourother post on Datagrids. By the way check out this link, it has Ajax updating a Datagrid; itspretty cool: http://aspalliance.com/773

    Best regards,

    Sean Gahan

    imRahulSoni 2 Mar 2006 8:13 PMVSS checkout could be annoying at times and I can understand that, but as a developer Imade it a habit to organize my work and checkout the files (which I needed for that session)at one shot. And once I am done with the development, Check 'em all IN, at once. It workedmost of the times for me and had added advantage that no other person could check outthat file in the meantime.

    But honestly, I have never seen that "mouse stuck" issue before. Although, I would like toknow that what happens if you use shortcuts, like F7 to go the code view and Shift+F7 to goback to the design view. Does it still remain stuck??

    Sean Gahan 3 Mar 2006 12:27 PMRahulso, Your solution for checking out several items at once would work, but my question is why ithappens in the first place. Why is it when I wish to view a page in design mode that is undersource control I get prompted. What happens to the document when you switch to that view?Also, the F7 is a good tip; I will try that next time.

    Best regards,

    Sean Gahan

    Sean Gahan 4 Apr 2006 2:23 PMOk, it happened again; the cursor got stuck inside a table while I was using the design modewhile working on an asp.net page. Your suggestion of switching to the code (+/ Shift+F7) didnot work, and I also tried switching to the HTML view (Ctrl+PgDn) and that did not work either.What did work was the Windows key + M to minimize all.

    Best regards,

  • 5/9/2015 What is a Crash (technically)... in ASP.NET and what to do if it happens? - Rahul Soni's blog - Site Home - MSDN Blogs

    http://blogs.msdn.com/b/rahulso/archive/2006/03/02/what-is-a-crash-technically-in-asp-net-and-what-to-do-if-it-happens.aspx 3/3

    Sean Gahan

    ultranomad 3 Jul 2007 10:00 AMHow come I am getting IIS 6.0 error on IIS 5.0 with ASP .NET 2.0?

    imRahulSoni 3 Jul 2007 4:48 PMHi ultranomad,

    I am afraid, I didn't get your issue. What is the error message which you see?

    JerryZhao 6 Aug 2007 10:02 AMPostProductionDebuggingforASP.NETApplications

    Options