.NET Framework Bookmark and Share   
 index > Building Development and Diagnostic Tools for .Net > Windows Service Crashes and JIT debug
 

Windows Service Crashes and JIT debug

All,

Sorry, this is not a short post, english is not my native language, if I confuse you, please ask, I will try to explain.

My Windows Service (myservice.exe) is based on .NET 2.0 framework (x86 32bit XP SP2), it uses threading and remoting, sometimes crashes.
When it crashes, I could found a log event from event viewer, sometimes I could not.

==============
Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date: 5/30/2009
Time: 7:46:40 AM
User: N/A
Computer: OEM-IDKVIEBJAWI
Description:
EventType clr20r3, P1 myservice.exe, P2 1.0.5.74, P3 4a121d7c, P4 mscorlib, P5 2.0.0.0, P6 471ebc5b, P7 1937, P8 0, P9 system.indexoutofrangeexception, P10 NIL.
==============

I have been trying to setup the registry to capture a memory dump, for example, I use these seetings:

(I use windbg version 6.11.0001 x86 32bit)

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"DbgManagedDebugger"="\"C:\\Program Files\\Debugging Tools for Windows\\cdb.exe\" -pv -p %ld -c \".dump /u /ma c:\\crashdump.dmp;.kill;qd\""
"DbgJITDebugLaunchSetting"=dword:00000002

It works with my test managed console application and winform application, their crash all create dump files.

BUT, no matter how I try, I just could not get these settings to work with windows service (myservice.exe)


Here are my questions:

1.Who add the log entry to windows event viewer, why sometimes it is there and sometimes it is not when myservice.exe crashes?

2.How do I capture the randomly crashing myservice.exe's memory dump?

3.Why the current registry setting does not work?

  • Edited bywebcliff2 Friday, June 05, 2009 6:21 PMmeanful title
  • Edited bywebcliff2 Thursday, June 04, 2009 11:53 PMos version
  •  

All Replies

  • Friday, June 05, 2009 2:02 PMp.b.a Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    When your service starts register for the AppDomain UnhandledException event and do you own logging - this way you have control over what's logged. Without knowing what the how the service works if you don't see any entry in the event log maybe it did not crash, it just terminated for whatever reason.

    Have you tried using AeDebug registry key instead of DbgManagedDebugger ? (http://technet.microsoft.com/en-us/library/cc738371(WS.10).aspx).
webcliff2

p.b.a.

Thanks for help!

I didrun drwtsn32 -i (Dr Watson, it sets AeDebug registry key ) and configure Dr Watson to capture all un-managed process crashes.
It did not help with myservice.exe crash, I am assuming it is because myservice.exe is a managed windows service.

Unfortunately I do not haveaccessto source code ,can'ttake AppDomain.UnhandledException approach.

  • Edited bywebcliff2 Friday, June 05, 2009 5:41 PMmissing words
  •  
  • Monday, June 08, 2009 7:52 PMJon LangdonMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    A few questions:

    What version of the the CLR are you using (version of c:\windows\microsoft.net\framework\v2.0.50727\mscorwks.dll will be sufficient)?
    What account is the service running as?
    Is the service interactive? I.e. does it have UI (even if it's just a console window)?

    Something to try in order to narrow down the point of failure:
    Can you remove the commands from your DbgManagedDebugger registration? I.e. just set it to "C:\program files\debugging tools for windows\cdb.exe" -pv -p %ld and see if the debugger is launched. If your service is non-interactive you won't see any debugger UI, so just check task manager and see if cdb.exeis running.

    If that works we'll see if we can figure out why the command(s) are failing.

    If that doesn't work can you provide a simple repro? Simplify the service code as much as possible and let us know how you're installing it.

    Regards,
    Jon

  • webcliff2
    Jon,

    Thanks for help!

    I have different versions of CLR (2.0 and 3.0)installed, myservice.exe was built with 2.0, and looks like it isloading C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll (reported byProcess Explorer)
    Ituses "Local System" account and the service is not interactive <-I think, how do I check?

    Setting DbgManagedDebuggerto "C:\program files\debugging tools for windows\cdb.exe" -pv -p %ld didn't fix the issue, I can not find any cdb.exe process running.

    I am trying to see if I can create a simple repro.


    The strange thing is, I think I managed to get it to work at some point by checking"Allow service to interact with desktop" on myservice.exe's service property.BUT today,checking the same checkbox does not work any more --> really confused by this one.

    Regards.


    webcliff2

    You can use google to search for other answers

    Custom Search

    More Threads

    • Will ICorProfilerInfo.SetFunctionReJIT be implemented in 3.5 (split from: Will there be a new CLR in 3.5?)
    • Creating A Helper Thread
    • Differences between dbgclr and mdbg when looking at variables in IronPython scripts...
    • Adding a VB/C# Editor into a .NET application
    • Production release!
    • .NET 2.0 : profiler adding static fields causes an assert in GetOffsetForStaticData
    • Profiling API and security
    • What would be the steps to actually remove the breakpoint?
    • Help ... ISymUnmanagedBinder2::GetReaderForFile2(...) returning 0x806D0005
    • Profiler get string argument value - GetStringLayout?