Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Script mysteriously stops executing...
November 13, 2009, 4:40 pm
rate this thread
I've got a fairly long-running maintenance script that uses the CLI.
It's performing thousands of quick DB queries and just takes a long
time to run. For some reason, the script seems to just exit midway
for no discernible reason (not in the same spot each time). I'm
trapping all PHP errors (using a register_shutdown_function() to trap
Fatal errors throw an instance of a custom Exception class, and the
Exception handler dumps a stack trace to the screen. Also the DB
calls are all performed via a custom Framework built on Pear::MDB2
which validates all queries and throws exceptions as well. I'm not
getting any output from that, the script just stops running.
log_errors is on and there are no messages in the error_log.
For fear it was a timeout issue, I have set_time_limit(0) at the head
of my script, but it hasn't made a difference.
I'm at a loss as to what the next diagnostic step is. I appreciate
- C. (http://symcbean.blogspot.c
November 13, 2009, 6:16 pm
Re: Script mysteriously stops executing...
When you say it stops running - does that mean the process terminates?
Might be memory leaks - but I'd expect to see a message reported to
stderr. You are recording the stderr and stdout aren't you?
You could try registering a shutdown function to see if it is exiting
rather than crashing, and adding a signal handler to trap and report
signals (or run it via a signal isolator). Make sure you've got your
system set up to record core dumps.