I have a multi-threaded application. It works fine for a month, and then stops responding to web requests. It is chewing 100% of a processor.
I need to know what it is doing when this happens. I know that madExcept can, when an exception occurs, dump the stack of all threads. How can I initiate this "manually" please?
I can probably work out a way to recognise the required situation, and other threads appear to be functioning, so I can tell one to do this from an external source. But I need to see "inside" to find out what is causing this, and where it is stuck. I hope you can help!
Probably worth saying that the ideal would be "non-destructive" but if it kills things, so be it. I have to restart the service anyway.
What's gone wrong in my code?
Re: What's gone wrong in my code?
Okay, funny how things are so simple once you ask someone else! I realised that the stack dump occurs whenever there is an Exception, and I call HandleException. Err, so why not just generate an exception myself, handle it, and see what happens? And of course, doing that gets me exactly what I want. So I can now create a file called crashdump.txt in a specific location, and the maintenance thread will spot it, rename it, and raise an Exception. Job done!
Thank you, marvellous madExcept. Worth its weight in gold.
Thank you, marvellous madExcept. Worth its weight in gold.
Re: What's gone wrong in my code?
FWIW, you could also run the tool "madTraceProcess.exe" in the moment when the CPU runs at 100%.
Re: What's gone wrong in my code?
Wow! I am amazed. I never knew that was there, and it isn't mentioned in the documentation pages. I figured it would have a problem with running on my server or something like debug rights, but it "just works". Goodness me, that's clever.