From:             unreal at slashorg dot net
Operating system: Linux 2.6.18
PHP version:      5.2.1
PHP Bug Type:     CGI related
Bug description:  Browser abort causes server hang with FastCGI

Description:
------------
PHP doesn't handle browser abort correctly.

- Use PHP to serve a file, using the code below
- Start downloading the file, and then abort.

Reproduce code:
---------------
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: public');
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename="' . basename($path) .
'";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($path));
$handle = fopen($path, 'rb');
do {
        $data = fread($handle, 8192);
        if (strlen($data) == 0) {
                break;
        }
        echo($data);
} while (true);
fclose($handle);

Expected result:
----------------
After browser abord, the server should remain responsive.

Actual result:
--------------
* Lots of errors in error_log:
'FastCGI: comm with server "/usr/local/www/cgi/php-cgi/php5.fcgi" aborted:
idle timeout (30 sec)'
'FastCGI: incomplete headers (0 bytes) received from server
"/usr/local/www/cgi/php-cgi/php5.fcgi"'

* Server stops responding, then after some time (maybe 5 mins), starts
responding again.

-- 
Edit bug report at http://bugs.php.net/?id=40556&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40556&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40556&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40556&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40556&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40556&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40556&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40556&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40556&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40556&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40556&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40556&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40556&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40556&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40556&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40556&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40556&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40556&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40556&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40556&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40556&r=mysqlcfg

Reply via email to