Ben,
My solution was to add a table to my database, and add an insert job id
into the table after the line that is causing the problem. When I submit
the script I use setTimeout to run an AJAX query of the table 5 seconds
later. If the line has failed the job id will not be in the table and I
alert the user. It works - and some day I hope to fix the software
problem and make this unnecessary.
Thanks,
Jim
Ben Dunlap wrote:
On Fri, Sep 4, 2009 at 2:38 PM, jim white <jbw2003@xxxxxxxxxxxxx
<mailto:jbw2003@xxxxxxxxxxxxx>> wrote:
It's a web app that draws maps in a browser. Sometime it will
generate a seg fault. The command should not take long, so if
there is some script construct that will throw an exception after
a few seconds if the command has not completed I could signal the
user that the map will not draw and to reload the page.
There's a pecl extension called Libevent that can apparently trigger
an action to occur after a certain amount of time has elapsed:
http://us3.php.net/manual/en/ref.libevent.php
I've not used it and have no idea how mature or reliable it is. I'm
also wondering whether any solution will work that relies on the same
script that's about to trigger a segfault.
I think I'd be inclined to build an XHR-based monitor to run in the
user's browser. Even simpler would be to start the map-building
process asynchronously with XHR and then just alert the user, or
automatically refresh the browser, if a certain amount of time elapses
before you get a response from the map-building script. But I don't
know how much you'd have to alter your existing client-side code to
use the latter method.
Either way it's creeping away from PHP so maybe I should leave it at that.
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php