com php-src: Fixed bug #69860: NEWS main/fastcgi.c main/fastcgi.h sapi/fpm/fpm/fpm_main.c
| From: | Nikita Popov | Date: | Sat, 11 Feb 2017 23:06:04 +0000 |
| Subject: | com php-src: Fixed bug #69860: NEWS main/fastcgi.c main/fastcgi.h sapi/fpm/fpm/fpm_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97069@lists.php.net to get a copy of this message | ||
Commit: 9814be4bc28892d1e0a5dc875fef0b4bde455d23
Author: Denis Yeldandi <dyeldandi@gramant.ru> Thu, 9 Feb 2017 10:22:37 +0300
Committer: Nikita Popov <nikita.ppv@gmail.com> Sun, 12 Feb 2017 00:06:04 +0100
Parents: db7c0badd477244e3b86c1624bd506651bdea0ba
Branches: PHP-7..0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9814be4bc28892d1e0a5dc875fef0b4bde455d23
Log:
Fixed bug #69860
Bugs:
https://bugs.php.net/69860
Changed paths:
M NEWS
M main/fastcgi.c
M main/fastcgi.h
M sapi/fpm/fpm/fpm_main.c
Diff:
diff --git a/NEWS b/NEWS
index ccd6c85..24f5d0f 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ PHP NEWS
. Fixed bug #61471 (Incomplete POST does not timeout but is passed to PHP).
(Zheng Shao)
+- FPM:
+ . Fixed bug #69860 (php-fpm process accounting is broken with keepalive).
+ (Denis Yeldandi)
+
- GD:
. Fixed bug #74031 (ReflectionFunction for imagepng is missing last two
parameters). (finwe)
diff --git a/main/fastcgi.c b/main/fastcgi.c
index dd7c7dd..39bfd34 100644
--- a/main/fastcgi.c
+++ b/main/fastcgi.c
@@ -462,6 +462,11 @@ void fcgi_terminate(void)
in_shutdown = 1;
}
+void fcgi_request_set_keep(fcgi_request *req, int new_value)
+{
+ req->keep = new_value;
+}
+
#ifndef HAVE_ATTRIBUTE_WEAK
void fcgi_set_logger(fcgi_logger lg) {
fcgi_log = lg;
@@ -1426,8 +1431,6 @@ int fcgi_accept_request(fcgi_request *req)
struct pollfd fds;
int ret;
- req->hook.on_read();
-
fds.fd = req->fd;
fds.events = POLLIN;
fds.revents = 0;
@@ -1440,8 +1443,6 @@ int fcgi_accept_request(fcgi_request *req)
}
fcgi_close(req, 1, 0);
#else
- req->hook.on_read();
-
if (req->fd < FD_SETSIZE) {
struct timeval tv = {5,0};
fd_set set;
@@ -1468,6 +1469,7 @@ int fcgi_accept_request(fcgi_request *req)
} else if (in_shutdown) {
return -1;
}
+ req->hook.on_read();
if (fcgi_read_request(req)) {
#ifdef _WIN32
if (is_impersonate && !req->tcp) {
diff --git a/main/fastcgi.h b/main/fastcgi.h
index bba6401..925d60c 100644
--- a/main/fastcgi.h
+++ b/main/fastcgi.h
@@ -102,6 +102,7 @@ int fcgi_accept_request(fcgi_request *req);
int fcgi_finish_request(fcgi_request *req, int force_close);
const char *fcgi_get_last_client_ip();
void fcgi_set_in_shutdown(int new_value);
+void fcgi_request_set_keep(fcgi_request *req, int new_value);
#ifndef HAVE_ATTRIBUTE_WEAK
typedef void (*fcgi_logger)(int type, const char *fmt, ...);
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 3ab92b3..695839c 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1996,7 +1996,8 @@ fastcgi_request_done:
requests++;
if (UNEXPECTED(max_requests && (requests == max_requests))) {
- fcgi_finish_request(request, 1);
+ fcgi_request_set_keep(request, 0);
+ fcgi_finish_request(request, 0);
break;
}
/* end of fastcgi loop */