php-fpm exits with status 0 on some failures to start
| Bug #62033 | php-fpm exits with status 0 on some failures to start | ||||
|---|---|---|---|---|---|
| Submitted: | 2012-05-14 22:00 UTC | Modified: | 2012-05-25 19:15 UTC | ||
| From: | js at justinsamuel dot com | Assigned: | fat (profile) | ||
| Status: | Closed | Package: | FPM related | ||
| PHP Version: | 5.4.3 | OS: | Linux (Ubuntu 12.04) | ||
| Private report: | No | CVE-ID: | None | ||
[2012-05-14 22:00 UTC] js at justinsamuel dot com
Description: ------------ When the php-fpm command fails because the 'user' value of a pool specifies a nonexistent user, php-fpm exits with 0 rather than a non-zero status. This is incorrect and causes problems with init scripts, for example. This happens with both php 5.3 and 5.4. Test script: --------------- Snippet of a pool configuration which will trigger the bug: [example.com] user = fakeuser ... Expected result: ---------------- php-fpm should exit with a non-zero status in all cases where there is an error which causes it to fail to start (including, but not limited to, nonexistent users). Actual result: -------------- $ php-fpm [14-May-2012 14:39:40] ERROR: [pool example.com] cannot get uid for user 'fakeuser' [14-May-2012 14:39:40] ERROR: FPM initialization failed $ echo $? 0
Patches
bug62033-v2.patch (last revision 2012-05-25 08:48 UTC by fat@php.net)bug62033.patch (last revision 2012-05-23 22:50 UTC by fat@php.net)
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2012-05-23 07:36 UTC] fat@php.net
-Status: Assigned +Status: Feedback
[2012-05-23 07:36 UTC] fat@php.net
[2012-05-23 20:54 UTC] js at justinsamuel dot com
[2012-05-23 22:10 UTC] fat@php.net
This is strange ... can you please test the following patch and see if exit code is 42 on error ? diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 95a7623..62c1b69 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -1803,7 +1803,8 @@ consult the installation file that came with this distribution, or visit \n\ } if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) { - return FAILURE; +// return FAILURE; + exit(42); } fpm_is_running = 1; thx ++ Jerome[2012-05-23 22:51 UTC] fat@php.net
-Status: Feedback +Status: Analyzed
[2012-05-23 22:51 UTC] fat@php.net
-Status: Analyzed +Status: Feedback
[2012-05-23 22:51 UTC] fat@php.net
[2012-05-24 00:08 UTC] js at justinsamuel dot com
-Status: Feedback +Status: Assigned
[2012-05-24 00:08 UTC] js at justinsamuel dot com
[2012-05-25 08:52 UTC] fat@php.net
-Status: Assigned +Status: Feedback
[2012-05-25 08:52 UTC] fat@php.net
[2012-05-25 16:19 UTC] js at justinsamuel dot com
[2012-05-25 19:15 UTC] fat@php.net
-Status: Feedback +Status: Closed
[2012-05-25 19:15 UTC] fat@php.net