httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Meta Seller Admin <>
Subject [users@httpd] After a PHP script timeout, Apache logs the error but may not cleanly exit the script
Date Tue, 01 Oct 2013 03:58:49 GMT
Hi. I'm wondering if anyone can help with this.

We're using PHP and Apache, hosted on a dedicated server running Debian
Linux. The specific versions in each case are mostly immaterial, as this
problem has been around since Debian 6, and is still present in Debian 7;
in the meantime we've been using the latest versions of all packages.

We're having problems with PHP script timeouts, which although rare, are
behaving erratically and causing severe problems when they do occur.

The timeouts are always recorded in the Apache log, and sometimes the
script and everything else may execute/terminate correctly, but often,
various failures may be observed, such as:


   timeouts not registered back to PHP - the script may not terminate as
   expected (the function registered with register_shutdown_function() - see
   code example below - may not be called);

   after a timeout, Apache may run in the background indefinitely, using up
   CPU resources in one core;

   Apache may fail altogether - no further requests serviced - Apache must
   be restarted.

The exact cause of the fault has not been found. It is reproducible on all
servers we deploy to.

Example PHP script:

function _on_shutdown()
    if (connection_status() & CONNECTION_TIMEOUT)
        echo 'ERROR: TIMEOUT!';
        //Do something else...
//...more code here...
//(various potentially long running scripts which may timeout)

The above was also posted here:


View raw message