Sounds like something that should go to PHP_5_2 branch also?

--Jani



Dmitry Stogov wrote:
dmitry          Tue Aug 26 09:56:09 2008 UTC

  Modified files:              (Branch: PHP_5_3)
/php-src NEWS /php-src/sapi/cgi cgi_main.c fastcgi.c fastcgi.h Log:
  Fixed bug #45786 (FastCGI process exited unexpectedly)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.286&r2=1.2027.2.547.2.965.2.287&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.286 
php-src/NEWS:1.2027.2.547.2.965.2.287
--- php-src/NEWS:1.2027.2.547.2.965.2.286       Mon Aug 25 18:40:44 2008
+++ php-src/NEWS        Tue Aug 26 09:56:08 2008
@@ -27,6 +27,7 @@
   relative time string. (Derick)
- Fixed bug #45798 (sqlite3 doesn't notice if variable was bound). (Felipe)
+- Fixed bug #45786 (FastCGI process exited unexpectedly). (Dmitry)
 - Fixed bug #45763 (mysqli::multi_query does not work with mysqlnd). (Johannes)
 - Fixed bug #45757 (FreeBSD4.11 build failure: failed include; stdint.h).
   (Hannes)
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.50.2.25&r2=1.267.2.15.2.50.2.26&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.25 
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.26
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.25    Mon Aug 18 10:49:35 2008
+++ php-src/sapi/cgi/cgi_main.c Tue Aug 26 09:56:08 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
-/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.25 2008/08/18 10:49:35 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.26 2008/08/26 09:56:08 dmitry Exp $ */
#include "php.h"
 #include "php_globals.h"
@@ -776,7 +776,7 @@
 #ifndef PHP_WIN32
                                !parent &&
 #endif
-                               
!fcgi_finish_request((fcgi_request*)SG(server_context))) {
+                               
!fcgi_finish_request((fcgi_request*)SG(server_context), 0)) {
                                php_handle_aborted_connection();
                        }
                } else {
@@ -1914,7 +1914,7 @@
                           get path_translated */
                        if (php_request_startup(TSRMLS_C) == FAILURE) {
                                if (fastcgi) {
-                                       fcgi_finish_request(&request);
+                                       fcgi_finish_request(&request, 1);
                                }
                                SG(server_context) = NULL;
                                php_module_shutdown(TSRMLS_C);
@@ -2056,7 +2056,7 @@
                        /* only fastcgi will get here */
                        requests++;
                        if (max_requests && (requests == max_requests)) {
-                               fcgi_finish_request(&request);
+                               fcgi_finish_request(&request, 1);
                                if (bindpath) {
                                        free(bindpath);
                                }
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.c?r1=1.4.2.13.2.28.2.5&r2=1.4.2.13.2.28.2.6&diff_format=u
Index: php-src/sapi/cgi/fastcgi.c
diff -u php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.28.2.5 
php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.28.2.6
--- php-src/sapi/cgi/fastcgi.c:1.4.2.13.2.28.2.5        Mon Aug 18 10:49:35 2008
+++ php-src/sapi/cgi/fastcgi.c  Tue Aug 26 09:56:08 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
-/* $Id: fastcgi.c,v 1.4.2.13.2.28.2.5 2008/08/18 10:49:35 dmitry Exp $ */
+/* $Id: fastcgi.c,v 1.4.2.13.2.28.2.6 2008/08/26 09:56:08 dmitry Exp $ */
#include "php.h"
 #include "fastcgi.h"
@@ -662,6 +662,7 @@
        unsigned char buf[FCGI_MAX_LENGTH+8];
req->keep = 0;
+       req->closed = 0;
        req->in_len = 0;
        req->out_hdr = NULL;
        req->out_pos = req->out_buf;
@@ -886,7 +887,6 @@
        HANDLE pipe;
        OVERLAPPED ov;
 #endif
-       fcgi_finish_request(req);
while (1) {
                if (req->fd < 0) {
@@ -1177,13 +1177,16 @@
        return len;
 }
-int fcgi_finish_request(fcgi_request *req)
+int fcgi_finish_request(fcgi_request *req, int force_close)
 {
        int ret = 1;
if (req->fd >= 0) {
-               ret = fcgi_flush(req, 1);
-               fcgi_close(req, 0, 1);
+               if (!req->closed) {
+                       ret = fcgi_flush(req, 1);
+                       req->closed = 1;
+               }
+               fcgi_close(req, force_close, 1);
        }
        return ret;
 }
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/fastcgi.h?r1=1.2.2.4.2.5.2.2&r2=1.2.2.4.2.5.2.3&diff_format=u
Index: php-src/sapi/cgi/fastcgi.h
diff -u php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.5.2.2 
php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.5.2.3
--- php-src/sapi/cgi/fastcgi.h:1.2.2.4.2.5.2.2  Mon Aug 18 10:49:35 2008
+++ php-src/sapi/cgi/fastcgi.h  Tue Aug 26 09:56:08 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
-/* $Id: fastcgi.h,v 1.2.2.4.2.5.2.2 2008/08/18 10:49:35 dmitry Exp $ */
+/* $Id: fastcgi.h,v 1.2.2.4.2.5.2.3 2008/08/26 09:56:08 dmitry Exp $ */
/* FastCGI protocol */ @@ -99,6 +99,7 @@
        int            fd;
        int            id;
        int            keep;
+       int            closed;
int in_len;
        int            in_pad;
@@ -118,7 +119,7 @@
 int fcgi_listen(const char *path, int backlog);
 void fcgi_init_request(fcgi_request *req, int listen_socket);
 int fcgi_accept_request(fcgi_request *req);
-int fcgi_finish_request(fcgi_request *req);
+int fcgi_finish_request(fcgi_request *req, int force_close);
char* fcgi_getenv(fcgi_request *req, const char* var, int var_len);
 char* fcgi_putenv(fcgi_request *req, char* var, int var_len, char* val);





--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to