#38435 [Asn->Fbk]: PHP FastCGI dies with segmentation fault wgen the HTTP clients aborts the conn

From: Date: Mon, 14 Aug 2006 09:34:27 +0000
Subject: #38435 [Asn->Fbk]: PHP FastCGI dies with segmentation fault wgen the HTTP clients aborts the conn
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100752@lists.php.net to get a copy of this message
 ID:               38435
 Updated by:       tony2001@php.net
 Reported By:      pts at fazekas dot hu
-Status:           Assigned
+Status:           Feedback
-Bug Type:         Output Control
+Bug Type:         CGI related
 Operating System: Linux 2.6
 PHP Version:      5.1.4
 Assigned To:      dmitry
 New Comment:

Please try using this CVS snapshot:

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




Previous Comments:
------------------------------------------------------------------------

[2006-08-12 14:05:52] pts at fazekas dot hu

Description:
------------
The FastCGI process dies (SIGSEGV) when the HTTP client aborts the
connection, but PHP wants to echo() more. The ignore_user_abort() state
doesn't matter, PHP dies anyway. See the code below.

To reproduce it, run wget http://.../code_below.php, and
abort wget
with Ctrl-<C>. See the Apache error log for the error message.

I think this is a serious bug that prevents normal use of PHP FastCGI.

Reproduce code:
---------------
<?php
# PHP 5.1.4 and PHP 4.3.10 are both affected with Apache 1.3.33 +
FastCGI
# vvv from Apache error log:
# [Sat Aug 12 15:50:40 2006] [warn] FastCGI: (dynamic) server
"/foo/php-cgi" (pid 3279) terminated due to uncaught signal '11'
(Segmentation fault)
# [Sat Aug 12 15:50:40 2006] [warn] FastCGI: (dynamic) server
"/foo/php-cgi" restarted (pid 3284)
function foo() {
}
register_shutdown_function('foo');
ignore_user_abort(TRUE);
#ignore_user_abort(FALSE); # Dat: this doesn't help either
# phpinfo(); exit;
$A="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
$A.=$A; $A.=$A; $A.=$A; $A.=$A; $A.=$A; $A.=$A;
$str=".$A";
for ($I=1; $I<1000; $I++) {
  echo $str;
  #sleep(1); # this doesn't prevent the bug, only delays it
}


Expected result:
----------------
The PHP FastCGI process should continue running and wait for more
requests.

Actual result:
--------------
The PHP FastCGI process dies with SIGSEGV (Segmentation fault, signal
11).


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38435&edit=1


Thread (3 messages)

« previous php.bugs (#100752) next »