[DUG] app terminating abruptly
Ross Levis
ross at stationplaylist.com
Wed Nov 30 16:57:45 NZDT 2005
I've used madExcept several times to track down problems, but as a test
just now I did generate an exception in a thread and it did popup the
mad exception box.
I just turned on Access Violations to be trapped by the debugger and
found an AV at the same address occuring in my initial startup
procedure.
The error was occuring at an Application.ProcessMessages which I'm doing
as it runs through the initial startup routine displaying information on
the splash screen. This should be fine since there is nothing else
going on at the time.
I've worked out that a procedure several lines above the ProcessMessages
is the culprit. This opens several DLL's dynamically to retrieve a
description and closes them afterwatds, one at a time.
It seems that perhaps one of the DLL's is not closing when unloaded, if
that's possible, and accessing memory that is not allocated at a later
time when doing a ProcessMessages.
I've managed to prevent the error at startup by doing a
Application.HandleMessage just before unloading the DLL. I'm not sure
yet if this will stop the program from terminating unexpectedly when
running stand-alone.
I can't imagine why a DLL would need messages to be processed. Surely
it should do everything in realtime. Maybe the DLL is using a thread to
do something and this is still running then the DLL is unloaded. Does
this sound feesible?
Cheers,
Ross.
----- Original Message -----
From: "Nahum.Wild" <Nahum.Wild at payglobal.com>
To: "'NZ Borland Developers Group - Delphi List'" <delphi at ns3.123.co.nz>
Sent: Wednesday, November 30, 2005 3:07 PM
Subject: RE: [DUG] app terminating abruptly
We had a problem when upgrading version of madExcept and 'the way our
code
was' (tm) that ment we had to manually setup madExcept within the code
on
app startup - rather than just dumping it. Assuming you havn't done
this
already, a quick and dirty test is to throw an exception off a button
press
or something and see if it is caught correctly by madExcept, then try
from a
thread.
Nahum.
> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz
> [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of Ross Levis
> Sent: Wednesday, 30 November 2005 14:36 p.m.
> To: Nahum.Wild at payglobal.com; NZ Borland Developers Group -
> Delphi List
> Subject: Re: [DUG] app terminating abruptly
>
> I've got madExcept installed and enabled it initially when
> this problem started, but guess what, the app still
> terminates with no error box or anything.
>
> It is also not a proper program closure since the system tray
> icon stays in the system tray until you move the mouse over it.
>
> I didn't know about OutputDebugString. What I did do is
> write a Debug unit which outputs a string to a file. I
> haven't yet put a line into every procedure and function at
> this stage so that may help as well, but I have a timer at
> 10ms doing things like checking for data on TCP sockets and
> various other things so this file will get big very fast. I
> think I'll change it to keep only the last few lines.
>
> Cheers,
> Ross.
>
> ----- Original Message -----
> From: "Nahum.Wild" <Nahum.Wild at payglobal.com>
> To: "'NZ Borland Developers Group - Delphi List'"
> <delphi at ns3.123.co.nz>
> Sent: Wednesday, November 30, 2005 11:12 AM
> Subject: RE: [DUG] app terminating abruptly
>
>
>
> Use madExcept
> [http://www.madexcept.com/madExceptDescription.htm] it'll
> give
> you a call stack for each thread running when the crash
> occurs. Since
> using
> it our tricky unexplained crashes have turned into 'it crashed there,
> now
> why did it do that' type problems.
>
> Nahum.
>
> > -----Original Message-----
> > From: delphi-bounces at ns3.123.co.nz
> > [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of Conor Boyd
> > Sent: Wednesday, 30 November 2005 11:03 a.m.
> > To: 'NZ Borland Developers Group - Delphi List'
> > Subject: RE: [DUG] app terminating abruptly
> >
> > In terms of logging, you could look at tracing using the
> > OutputDebugString method in the Windows unit (D5 anyway).
> >
> > If you're outputting stuff via that method, you could pick it
> > up in realtime and remotely using something like DebugView
> > from Sysinternals
> > (http://www.sysinternals.com/Utilities/DebugView.html)
> >
> > HTH,
> >
> > Conor
> >
> > -----Original Message-----
> > From: delphi-bounces at ns3.123.co.nz
> > [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of Robert martin
> >
> > You might also want to log where your code is running in a
> > file log, this might give you a hint as to where the error is
> > occurring.
> >
> > [snip]
> >
> > _______________________________________________
> > Delphi mailing list
> > Delphi at ns3.123.co.nz
> > http://ns3.123.co.nz/mailman/listinfo/delphi
> >
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi
More information about the Delphi
mailing list