com php-src: Fixed bug #78469: NEWS main/fastcgi.c
| From: | Nikita Popov | Date: | Fri, 30 Aug 2019 14:06:50 +0000 |
| Subject: | com php-src: Fixed bug #78469: NEWS main/fastcgi.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108160@lists.php.net to get a copy of this message | ||
Commit: 8f564e5308970e3c1b96fd17e493c5c3a952954b
Author: Sergei Turchanov <turchanov@farpost.com> Wed, 28 Aug 2019 13:05:14 +1000
Committer: Nikita Popov <nikita.ppv@gmail.com> Fri, 30 Aug 2019 16:06:50 +0200
Parents: ed749edd477bfcc3923c086a6443aaa91192e5b7
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8f564e5308970e3c1b96fd17e493c5c3a952954b
Log:
Fixed bug #78469
fcgi_accept_request function is supposed to call a FastCGI implementation's
on_accept hook when entering an "accepting" stage (that is right before
calling "accept"). This hook implementation (fpm_request_accepting) updates
a worker state to an "accepting" state which is effectively an "Idle" state,
and updates counters on the scoreboard of the corresponding pool (idle++,
active--).
But this is not done when listening for client connections on a named pipe on
Windows platform. In that case a combination of
ConnectNamedPipe/WaitForSingleObject is used (to be able to catch in_shutdown
as far as I understand), but it is nonetheless functionally equivalent to
"accept" call. Also by not calling on_hook neither a worker's state is updated
to "accepting" state nor scoreboard counters are updated.
Bugs:
https://bugs.php.net/78469
Changed paths:
M NEWS
M main/fastcgi.c
Diff:
diff --git a/NEWS b/NEWS
index 838f1d2..8ededb0 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ PHP NEWS
. Fixed bug #78412 (Generator incorrectly reports non-releasable $this as GC
child). (Nikita)
+- FastCGI:
+ . Fixed bug #78469 (FastCGI on_accept hook is not called when using named
+ pipes on Windows). (Sergei Turchanov)
+
- MySQLnd:
. Fixed connect_attr issues and added the _server_host connection attribute.
(Qianqian Bu)
diff --git a/main/fastcgi.c b/main/fastcgi.c
index 3181661..4b3dd31 100644
--- a/main/fastcgi.c
+++ b/main/fastcgi.c
@@ -1375,6 +1375,8 @@ int fcgi_accept_request(fcgi_request *req)
if (in_shutdown) {
return -1;
}
+
+ req->hook.on_accept();
#ifdef _WIN32
if (!req->tcp) {
pipe = (HANDLE)_get_osfhandle(req->listen_socket);
@@ -1405,8 +1407,6 @@ int fcgi_accept_request(fcgi_request *req)
sa_t sa;
socklen_t len = sizeof(sa);
- req->hook.on_accept();
-
FCGI_LOCK(req->listen_socket);
req->fd = accept(listen_socket, (struct sockaddr *)&sa, &len);
FCGI_UNLOCK(req->listen_socket);