What's gone wrong in my code?

delphi package - automated exception handling

What's gone wrong in my code?

Postby mj » Tue Nov 21, 2017 8:55 am

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.
mj
 
Posts: 13
Joined: Wed Sep 15, 2004 8:00 pm

Re: What's gone wrong in my code?

Postby mj » Tue Nov 21, 2017 9:41 am

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.
mj
 
Posts: 13
Joined: Wed Sep 15, 2004 8:00 pm

Re: What's gone wrong in my code?

Postby madshi » Wed Nov 22, 2017 4:05 pm

FWIW, you could also run the tool "madTraceProcess.exe" in the moment when the CPU runs at 100%.
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm

Re: What's gone wrong in my code?

Postby mj » Thu Nov 23, 2017 8:51 am

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.
mj
 
Posts: 13
Joined: Wed Sep 15, 2004 8:00 pm

Re: What's gone wrong in my code?

Postby madshi » Thu Nov 23, 2017 8:57 am

8)
madshi
Site Admin
 
Posts: 9469
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 4 guests