php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37256 php-fastcgi + CLOSE_WAIT
Submitted: 2006-05-01 03:31 UTC Modified: 2006-05-24 09:43 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: faerion at eggdrop dot org dot ru Assigned: dmitry (profile)
Status: Closed Package: Other web server
PHP Version: 5.1.2 OS: Linux 2.6.15
Private report: No CVE-ID: None
 [2006-05-01 03:31 UTC] faerion at eggdrop dot org dot ru
Description:
------------
I use nginx+php-fastcgi under linux. My script outputs some part of file and waits for ipc message to continue sending file. max_execution_time is set to 0, ignore_user_abort is off. When user aborts the connection - nginx closes client connection and connection to php-fastcgi server. But the socket on php doesn't close and remains beeing in CLOSE_WAIT state without any timeout. There is also no script execution break caused by connection abort - connection_status() always returns 0. Example of netstat output:

tcp        1      0 127.0.0.1:10000             127.0.0.1:42347             CLOSE_WAIT  29566/php

Reproduce code:
---------------
while (!$t) {
                if (msg_receive($GLOBALS['stream_queue'], 1, $msg_type, 1024, $msg, true, MSG_IPC_NOWAIT)) {
                        $t = true;
                        } else {
                        usleep(10000);
                        }
                }

Expected result:
----------------
That code execution should break on user abort.

Actual result:
--------------
Actually it doesn't break.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-01 14:43 UTC] tony2001@php.net
Please try using this CVS snapshot:

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


 [2006-05-01 19:06 UTC] faerion at eggdrop dot org dot ru
PHP 5.2.0-dev (cgi-fcgi) (built: May  1 2006 14:00:29)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

The same results with latest CVS snapshot:
tcp        1      0 127.0.0.1:10000             127.0.0.1:54728             CLOSE_WAIT  29561/php
 [2006-05-03 13:23 UTC] iliaa@php.net
Please try using this CVS snapshot:

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


 [2006-05-04 19:14 UTC] faerion at eggdrop dot org dot ru
PHP 5.1.5-dev (cgi-fcgi) (built: May  4 2006 14:15:11)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Nothing changes.
 [2006-05-04 19:28 UTC] tony2001@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.


 [2006-05-11 01:04 UTC] faerion at eggdrop dot org dot ru
Checked w/o any extension installed, got the same problem.
 [2006-05-12 05:49 UTC] faerion at eggdrop dot org dot ru
Tested on:
PHP 5.1.4 (cgi-fcgi) (built: May 11 2006 22:29:16)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
on FreeBSD 6.0-RELEASE box. Got the same problem. Script used for testing located here: http://rouge.anarxi.st/php/debug.phps
 [2006-05-24 09:43 UTC] dmitry@php.net
Fixed in CVS HEAD, PHP_5_2 and PHP_5_1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC