none
How to get StackOverflowException stacktrace without debugger? RRS feed

  • Question

  • We have a problem with our server application - sometimes it's crashed with StackOverflowException and we have no clue to find where it's happened. The worst thing is it happens only on our release server and very rarely (once per ~50 hours of uptime), but it's consequences are devastating. Since it can occur at any time, attaching debugger to this application is not acceptable - it will hangs application up to user response instead, which means unpredictably large out-of-service time for our project. Thus I am looking for a way to log an exception stacktrace in some way to be able automatically restart application immediately. As far as I know, debugger is special type of CLR hosting process and, thus, it may be possible to write special host for my needs as mentioned above. Can someone guide me how?
    Saturday, December 6, 2008 7:06 PM

Answers

  • > some way to be able automatically restart application immediately.

    Did you implement your server as a Windows service?  If so, the Control Panel settings for your service can be used to configure an automatic restart.

    As for determining the cause of the error, consider collecting a crash dump.  This will allow you to debug offline after the fact.  The tools for doing this kind of work are rather primitive compared to what most people are used to with Visual Studio.    Generally, you will need adplus and windbg.  See this article:  http://msdn.microsoft.com/en-us/library/ms954593.aspx  It is written with ASP.NET in mind, but it doesn't look like it would be too hard to adapt this to work with other executables as well.
    Saturday, December 6, 2008 7:27 PM

All replies

  • > some way to be able automatically restart application immediately.

    Did you implement your server as a Windows service?  If so, the Control Panel settings for your service can be used to configure an automatic restart.

    As for determining the cause of the error, consider collecting a crash dump.  This will allow you to debug offline after the fact.  The tools for doing this kind of work are rather primitive compared to what most people are used to with Visual Studio.    Generally, you will need adplus and windbg.  See this article:  http://msdn.microsoft.com/en-us/library/ms954593.aspx  It is written with ASP.NET in mind, but it doesn't look like it would be too hard to adapt this to work with other executables as well.
    Saturday, December 6, 2008 7:27 PM
  • > Did you implement your server as a Windows service?

    It's a console application, controlled by the separate application, which has many diagnostic probes to find out that restart is needed. Autorestart is not a problem by itself - the StackOverflowException source is one. Due to your post, we will incorporate ADPlus usage into that control application to attach it to any new instance of server application it's spawned.

    Great thanks for your advise!
    Sunday, December 7, 2008 12:31 AM
  • Doesn't EventLog give you anything?

    -sanket
    Wednesday, December 10, 2008 12:28 AM