php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19480 register_shutdown_function causes Apache to hang
Submitted: 2002-09-18 14:48 UTC Modified: 2002-09-23 18:31 UTC
From: colin at easydns dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4CVS-2002-09-18 OS: Linux 2.4.6
Private report: No CVE-ID: None
 [2002-09-18 14:48 UTC] colin at easydns dot com
Take this script:

<?

function aborted() {
        global $i;
        mail('user@example.com', 'aborted',
                'conn_status: ' . (int)connection_status() .
                "\nI counted to $i"
        );
        exit;
}

# register_shutdown_function('aborted');



$i = 0;
while (true) {
        echo $i++ . "\n";
        flush();
}

?>


If run as is, it works as expected: happily counting away until it times out, or you abort the script.

If you uncomment the register_shutdown_function line and abort the script part-way through, Apache doesn't seem to close the connection.  And, in fact, all other Apache processes get "hung" up waiting for it.  Running <i>apachectl server-status</i> shows this.

Let me know if you need more info.

(This was actually tested on 4.3.0-dev, built Aug 27 2002.  I'm getting the current CVS version now, but I understand from other people that this will still not function.)

- Colin

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-22 14:53 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

Unable to replicate on latest CVS w/ Apache 1.3.26.
 [2002-09-23 12:25 UTC] colin at easydns dot com
Yeah, the current CVS seems to have fixed it.

Dunno if this is important but ... when I stop the script in my browser, it's counted up to 568247, yet the email I get says it's counted to 584359.  I don't have output buffering enabled.
 [2002-09-23 18:31 UTC] sniper@php.net
Fixed -> closed.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 00:01:28 2024 UTC