Skip to content

Commit 8f564e5

Browse files
turchanovnikic
authored andcommitted
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.
1 parent ed749ed commit 8f564e5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ PHP NEWS
77
. Fixed bug #78412 (Generator incorrectly reports non-releasable $this as GC
88
child). (Nikita)
99

10+
- FastCGI:
11+
. Fixed bug #78469 (FastCGI on_accept hook is not called when using named
12+
pipes on Windows). (Sergei Turchanov)
13+
1014
- MySQLnd:
1115
. Fixed connect_attr issues and added the _server_host connection attribute.
1216
(Qianqian Bu)

main/fastcgi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,8 @@ int fcgi_accept_request(fcgi_request *req)
13751375
if (in_shutdown) {
13761376
return -1;
13771377
}
1378+
1379+
req->hook.on_accept();
13781380
#ifdef _WIN32
13791381
if (!req->tcp) {
13801382
pipe = (HANDLE)_get_osfhandle(req->listen_socket);
@@ -1405,8 +1407,6 @@ int fcgi_accept_request(fcgi_request *req)
14051407
sa_t sa;
14061408
socklen_t len = sizeof(sa);
14071409

1408-
req->hook.on_accept();
1409-
14101410
FCGI_LOCK(req->listen_socket);
14111411
req->fd = accept(listen_socket, (struct sockaddr *)&sa, &len);
14121412
FCGI_UNLOCK(req->listen_socket);

0 commit comments

Comments
 (0)