php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76948 Failed shutdown/reboot or end session in Windows
Submitted: 2018-09-29 13:58 UTC Modified: 2018-10-02 23:02 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: enyby at yandex dot ru Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 7.2.10 OS: Windows 7 x64
Private report: No CVE-ID: None
 [2018-09-29 13:58 UTC] enyby at yandex dot ru
Description:
------------
I run FastCGI server via 
php-cgi.exe -b 9001
It spawn lot of workers.
If I try end Windows session, or reboot, or shutdown, windows stuck on windows with message about php-cgi.exe

The application has failed to start correctly (0xc0000142)

This dialog can not be closed because recreated many times.

Force close opened apps (ask from windows) do not help.

As I see windows kill workers one-by-one, but main process spawn new. And it is fall in endless loop: window close workers, root process spawn new ones.

I think php-cgi must detect windows shutdown or use way for spawn workers which do not bypass blocking by system.

Before php7 (php 5.6 or older) issue not happens.
I see few windows with error 0xc0000142 on reboot, but it is be few of them, not endless counts.

Expected result:
----------------
Reboot Windows

Actual result:
--------------
Stuck on dialog 

php-cgi.exe
The application has failed to start correctly (0xc0000142)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-29 14:54 UTC] enyby at yandex dot ru
Tested:
PHP 7.2.8 (built: Jul 18 2018 10:03:02) ( NTS MSVC15 (Visual C++ 2017) x64 )
PHP 7.2.10 (built: Sep 13 2018 00:47:25) ( NTS MSVC15 (Visual C++ 2017) x64 )
 [2018-10-02 22:29 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2018-10-02 22:29 UTC] ab@php.net
Thanks for the report. How exactly do you run php-cgi? Which exact Windows is that, with or without SP? Unfortunately I have no chance to test on win7 in near future, on win10 i don't see such issue.

Thanks.
 [2018-10-02 22:43 UTC] enyby at yandex dot ru
-Status: Feedback +Status: Open
 [2018-10-02 22:43 UTC] enyby at yandex dot ru
I run 'php-cgi.exe -b 9001'
Windows 7 Maximum SP1 x64
 [2018-10-02 22:58 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2018-10-02 22:58 UTC] ab@php.net
The exact command won't spawn anything by default. It would only spawn some child processes, if PHP_FCGI_CHILDREN was passed to the environment. There might be more factors, please check the environment. At logout those children should be recycled as they're all held in the same job group. 

Thanks.
 [2018-10-02 23:02 UTC] enyby at yandex dot ru
-Status: Feedback +Status: Open
 [2018-10-02 23:02 UTC] enyby at yandex dot ru
set PHP_FCGI_CHILDREN=20
set PHP_FCGI_MAX_REQUESTS=0

As I see child process has killed by windows _before_ root process. So it cause bug.
If I kill root process manually then I able reboot windows and all process closed.
 [2018-10-03 10:17 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b0547a3dfba6702e7cc94476d4d422374c20b4b8
Log: Fixed bug #76948 Failed shutdown/reboot or end session in Windows
 [2018-10-03 10:17 UTC] ab@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Wed Nov 14 15:01:27 2018 UTC