Spotting Crashed Application

MRAB google at mrabarnett.plus.com
Wed May 16 15:33:27 EDT 2007


On May 16, 1:55 am, Steve Holden <s... at holdenweb.com> wrote:
> Robert Rawlins - Think Blue wrote:
>
> > Hello Guys,
>
> > I've got an application that I've written, and it sits in an embedded
> > system, from time to time the application will crash, I'm not quite sure
> > what's causing this, but as we test it more and more we'll grasp a
> > better understanding and fix the issues.
>
> > However, until then I need a quick solution which can spot the crash and
> > reboot the system. Is there any generic way of writing a separate
> > application that'll spot the crash in my main application? If not then i
> > was thinking about having my core application log itself as 'alive'
> > every 5 minutes or so. My new 'spotter' application can check this log,
> > if it's not been written too in say 6 minutes then the main app must
> > have crashed, and it can reboot.
>
> > Any suggestions on how best to handle this? Obviously finding the bug in
> > my main app is paramount, but a failsafe will never hurt.
>
> I don't know of any pre-written functionality, but I'd recommend using a
> UDP socket for this. Let your application send a packet (say) every 30
> seconds and have the monitoring application restart it if it doesn't
> hear a packet for 90 seconds.
>
An alternative would be for the spotter to start the application using
CreateProcess (this is on MS Windows) and then wait on the handle with
WaitForSingleObject. When the application quits or crashes the wait
will succeed and the spotter can then start the application again.




More information about the Python-list mailing list