Tutorial :How to get a call stack for an intermittently crashing devenv.com?



Question:

I have a nightly build DOS batch script that invokes devenv.exe to build a solution file. Intermittently I observe a devenv.com crash. I get a DW20.exe "share your pain" dialog.

1) If Debug button is pressed, I am not presented with a usual "Choose your debugger" window. Rather, it does nothing.

2) If I launch a Visual Studio and try to attach to devenv.com, it says that the application appears to be deadlocked or waiting for an operation to finish. (I think because it's debugged by DW20.exe)

What would you recommend I do to get a decent call stack?

EDIT

I was successful in getting WinDBG to attach. Executed the k command. Does the following look like something meaningful that can be passed on to the compiler team? Is there a way to look at the current exception?

(e90.fb8): Break instruction exception - code 80000003 (!!! second chance !!!)  eax=0012ccb8 ebx=04ed2750 ecx=0111bdc4 edx=5a57f004 esi=00000000 edi=14ed1000  eip=77e4bef7 esp=0012ccb4 ebp=0012cd08 iopl=0         nv up ei pl zr na pe nc  cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246  *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll -   kernel32!RaiseException+0x3c:  77e4bef7 5e              pop     esi  Missing image name, possible paged-out or corrupt data.  Missing image name, possible paged-out or corrupt data.  Missing image name, possible paged-out or corrupt data.  Missing image name, possible paged-out or corrupt data.  0:000> k  ChildEBP RetAddr    WARNING: Stack unwind information not available. Following frames may be wrong.  0012cd08 5a760cf1 kernel32!RaiseException+0x3c  0012cd58 5a766105 cslangsvc!InMemoryCompile+0x4c6c1  0012cd7c 5a767375 cslangsvc!InMemoryCompile+0x51ad5  0012cd84 5a767637 cslangsvc!InMemoryCompile+0x52d45  00000000 00000000 cslangsvc!InMemoryCompile+0x53007  

I am trying to get !analyze -v to work.

0:000> !analyze -v  *******************************************************************************  *                                                                             *  *                        Exception Analysis                                   *  *                                                                             *  *******************************************************************************    ***** OS symbols are WRONG. Please fix symbols to do analysis.    *************************************************************************  ***                                                                   ***  ***                                                                   ***  ***    Your debugger is not using the correct symbols                 ***  ***                                                                   ***  ***    In order for this command to work properly, your symbol path   ***  ***    must point to .pdb files that have full type information.      ***  ***                                                                   ***  ***    Certain .pdb files (such as the public OS symbols) do not      ***  ***    contain the required information.  Contact the group that      ***  ***    provided you with these symbols if you need this command to    ***  ***    work.                                                          ***  ***                                                                   ***  ***    Type referenced: ntdll!_PEB                                    ***  ***                                                                   ***  *************************************************************************  c0000005 Exception in ext.analyze debugger extension.  PC: 014d7875  VA: 00000000  R/W: 0  Parameter: 0001003f  

EDIT 2

I found out that there are these wonderful SOS extensions to WinDBG. Apparently I can use them to debug C# Compiler...

0:000> !PrintException  There is no current managed exception on this thread  0:000> !clrstack  OS Thread Id: 0x9fc (0)  ESP       EIP       0012ee08 77e4bef7 [ComPlusMethodFrameGeneric: 0012ee08] Microsoft.Build.Tasks.Hosting.ICscHostObject.Compile()  0012ee18 6be671ab Microsoft.Build.Tasks.Csc.CallHostObjectToExecute()  0012ee48 6c0aed17 Microsoft.Build.Utilities.ToolTask.Execute()  0012ee7c 6bcbb348 Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode, System.Collections.Hashtable, Microsoft.Build.BuildEngine.BuildPropertyGroup, Boolean ByRef)  0012ef24 6bcadf87 Microsoft.Build.BuildEngine.Target.ExecuteAllTasks(Microsoft.Build.BuildEngine.DependencyAnalysisResult, System.Collections.Hashtable, System.Collections.Hashtable, Microsoft.Build.BuildEngine.ItemBucket, System.Collections.ArrayList, Microsoft.Build.BuildEngine.BuildPropertyGroup)  0012efa0 6bcac7c0 Microsoft.Build.BuildEngine.Target.ExecuteAllTasks()  0012efec 6bcad05b Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)  0012f070 6bcacfa6 Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)  0012f0f4 6bcacfa6 Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)  0012f178 6bcacfa6 Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary)  0012f1fc 6bc9b20d Microsoft.Build.BuildEngine.Project.DoBuild(System.String[], System.Collections.IDictionary, Boolean)  0012f250 6bca2134 Microsoft.Build.BuildEngine.Engine.BuildProject(Microsoft.Build.BuildEngine.Project, System.String[], System.Collections.IDictionary, Microsoft.Build.BuildEngine.BuildSettings, Boolean)  0012f2ac 6bc9af03 Microsoft.Build.BuildEngine.Project.Build(System.String[], System.Collections.IDictionary)  0012f2c0 04711a36 Microsoft.VisualStudio.Build.ComInteropWrapper.ProjectShim.BuildTarget(System.String, System.Collections.IDictionary)  0012f4f4 79f68cde [GCFrame: 0012f4f4]   0012f650 79f68cde [ComMethodFrame: 0012f650]   

I am still looking for a way to examine the exception contents. !PrintException did not find any exceptions.


Solution:1

You might try installing Debugging Tools for Windows then use the -iae option (for NTSD/CDB) or the -I option (for WinDBG) to have one of the debuggers from that package be the JIT/AeDebug debugger.


Solution:2

I finally arrived at an exception type and callstack for the faulting compiler. I did this by saving a full dump file (.dump /ma c:\myCSCdump.dmp), then opening the dump file as you would open any other project file in VS2005. Pressing the run button produced the following in the call stack window:

kernel32.dll!_RaiseException@16()  + 0x3c bytes   

cslangsvc.dll!ALLOCHOST::ThrowOutOfMemoryException() + 0x10 bytes
cslangsvc.dll!PAGEHEAP::AllocPages() + 0xc1fd8 bytes
cslangsvc.dll!SYMTBL::GrowTable() + 0x5b bytes cslangsvc.dll!BSYMMGR::AddChild() + 0x3b bytes cslangsvc.dll!BSYMMGR::CreateGlobalSym() + 0x2ba bytes cslangsvc.dll!BSYMMGR::CreateMethod() + 0xc bytes
cslangsvc.dll!IMPORTER::ImportMethod() + 0x1d9 bytes
cslangsvc.dll!IMPORTER::DefineImportedType() + 0x3b2 bytes cslangsvc.dll!CLSDREC::prepareAggregate() + 0x8d bytes cslangsvc.dll!COMPILER::ForceAggStates() + 0x8e bytes
cslangsvc.dll!COMPILER::ForceAggStates() + 0x127 bytes cslangsvc.dll!COMPILER::EnsureState() + 0x2e bytes cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x23 bytes
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x2ba bytes
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x80 bytes
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x8a bytes
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x8a bytes
cslangsvc.dll!CLSDREC::CheckForTypeErrors() + 0x8a bytes
cslangsvc.dll!COMPILER::CheckForTypeErrors() + 0x100 bytes cslangsvc.dll!COMPILER::CompileAll() + 0x546 bytes cslangsvc.dll!COMPILER::Compile() + 0x7c bytes cslangsvc.dll!CController::RunCompiler() + 0x177 bytes cslangsvc.dll!CController::Compile() + 0x16 bytes
cslangsvc.dll!CCSharpProjectSite::BuildProjectCore() + 0x5a bytes
cslangsvc.dll!CProjectSite::BuildProject() + 0x11 bytes
csproj.dll!CCSharpBuildCompiler::DoMainBuild() + 0x88 bytes
csproj.dll!CCscMSBuildHostObject::Compile() + 0x4e bytes
mscorwks.dll!_CLRToCOMWorker@8() + 0x171 bytes


Solution:3

This is a bit wordy, so I'll post it as a reply. It's taken from Microsoft Connect site, in response to my issue. Reader might find it relevant:

Date: Thu, 7 May 2009 19:14:52 -0700

Greetings from Microsoft Connect!

This notification was generated for feedback item: Nightly build troubles (bucket 365749762) which you submitted at the Microsoft Connect site.

Thanks for reporting this issue you've encountered with Visual Studio 2005, and thanks for the dumps you've provided!

It looks like the issue is in cslangsvc.dll (the in-process C# Compiler), which is DevEnv is calling into to perform your build.

Our suggestion to work around this issue would be to try using MSBuild instead to do your nightly builds, as this should be more robust than automating DevEnv /build. Specifically, you'll likely avoid this particular issue as MSBuild will use csc.exe for compilation rather than cslangsvc.dll.

We're unlikely to have a further VS 2005 release to get out a fix to the cslangsvc issue, so I'm resolving this bug Won't Fix, but please reactivate it if you do still see an issue when using MSBuild.

Thanks again for all the information on this issue!

Alex Turner Program Manager Visual C# Compiler


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »