ofxWatchdog Detecting a non-responsive application?

Hi all,

I currently have an installation set up and it is using ofxWatchdog to catch any crashes and to restart the program, if a crash ensues. I have noticed that ofxWatchdog will not restart an application if it is ‘not-responding’ as it seems like the application is still in use…

Is there a way to get ofxWatchdog to detect if the application is unresponsive, yet still open, and then allow it to force quit the application and restart it?

Or would this have to be done with some script I would have to write using something like AppleScript?

Thank you to all of you amazing human beings.

can you describe what you mean by hang? for example, watchdog seems to detect while(true){}

Right, that’s what I thought would catch the freeze, as well, as the loop is hanging just like my application…

For example, my Kinect just stopped sending data to my program, altogether, which in turned caused the program to hang. The program remained up and running until I clicked within the application’s window, causing the spinning pinwheel to occur, and then I had to go manually force quit the application, rather than Watchdog doing so for me, which doesn’t make sense to me. Although its not the same as the loop hang in Watchdog’s example, it is still a hang nevertheless…

I am not sure if my application freezing was a peculiar case, but I’m gonna see if I can try to catch another crash of the application and see if Watchdog will close and restart the app for me.

not sure if it’s helpful but in the cases I’ve had where some sensor freezes, I’ve often just coded the detection of this – for example, I had a webcam that would freeze and always return the same pixels, so I compare the previous frame to the current frame to see if there is any difference and if there is no change after some time, I force the app to quit and restart.

1 Like

also I suspect ofxWatchdog catches crashes and freezes on the main thread, perhaps there’s another thread that’s crashing? (just speculating…)

i have never used ofxWatchdog. But usually i find pm2 quite useful, at least with node apps. Not sure how the best workflow ist for oF apps.

1 Like

Okay, right on, thank you Zach… Yes I think you’re right, ofxWatchdog is doing its job right. I went ahead and added in some helper conditions to check if the Kinect is sending in any data, and then from there I address whether or not to terminate and restart the application and it seems to be working correctly.

Thank you and Thomas for the help! Much appreciated :v:

Depending on the safety level you need a watchdog application running separately may be needed, with the main one periodically sending UDP messages on a socket and the watchdog listening for them and doing a kill + restart if needed. To make it even safer it is possible to move the watchdog on a separate machine.

regards
Davide

1 Like