Script mysteriously stops executing...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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
any advice.


Re: Script mysteriously stops executing...

Quoted text here. Click to load it

When you say it stops running - does that mean the process terminates?
Something else?

Quoted text here. Click to load it

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.


Re: Script mysteriously stops executing...

Quoted text here. Click to load it

Just FYI, CLI scripts have no time limit. I've had one just recently take 4
days to complete.

Site Timeline