Edit report at https://bugs.php.net/bug.php?id=62033&edit=1

 ID:                 62033
 Updated by:         f...@php.net
 Reported by:        js at justinsamuel dot com
 Summary:            php-fpm exits with status 0 on some failures to
                     start
-Status:             Assigned
+Status:             Feedback
 Type:               Bug
 Package:            FPM related
 Operating System:   Linux (Ubuntu 12.04)
 PHP Version:        5.4.3
 Assigned To:        fat
 Block user comment: N
 Private report:     N

 New Comment:

Hi again,

here is a new revision of the patch. Now, when daemonized, the calling process 
register 2 signal handler for USR1 and USR2 just before forking the master 
process. After initialization ends on the master process, it sends USR1 if 
successful or USR2 otherwise to the calling process. On USR1 signal, the 
calling 
process exits with 0, on USR2 it exists with error 78 (EX_CONFIG) and if does 
not receive anything, there's a 10 seconds timeout to exit with code 70 
(EX_SOFTWARE).

Can you please test it ?

thx
++ Jerome


Previous Comments:
------------------------------------------------------------------------
[2012-05-25 08:48:17] f...@php.net

The following patch has been added/updated:

Patch Name: bug62033-v2.patch
Revision:   1337935697
URL:        
https://bugs.php.net/patch-display.php?bug=62033&patch=bug62033-v2.patch&revision=1337935697

------------------------------------------------------------------------
[2012-05-24 00:08:03] js at justinsamuel dot com

I've tested this patch with the current PHP-5.3. The problem still persists. 

A quick look with strace makes it seem that a child process is exiting with the 
status that is expected from the patch (78) but its parent is not.

# rm -f /tmp/php-fpm.strace.*
# strace -o /tmp/php-fpm.strace -ff -f /opt/test/php5.3/sbin/php-fpm 
--fpm-config /root/php-test/fpm.conf 
[23-May-2012 18:54:57] ERROR: [pool example.com] cannot get uid for user 
'fakeuser'
[23-May-2012 18:54:57] ERROR: FPM initialization failed
# echo $?
0
# ll /tmp/php-fpm.strace.*
-rw-r--r-- 1 root root 25282 May 23 18:54 /tmp/php-fpm.strace.996
-rw-r--r-- 1 root root  4125 May 23 18:54 /tmp/php-fpm.strace.997
# grep -B 2 exit /tmp/php-fpm.strace.*
/tmp/php-fpm.strace.996-clone(child_stack=0, 
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7f2e60ff19d0) = 997
/tmp/php-fpm.strace.996-munmap(0x7f2e60f60000, 323584)          = 0
/tmp/php-fpm.strace.996:exit_group(0)                           = ?
--
/tmp/php-fpm.strace.997-write(3, "[23-May-2012 18:54:57] ERROR: FP"..., 56) = 56
/tmp/php-fpm.strace.997-write(2, "[23-May-2012 18:54:57] ERROR: FP"..., 56) = 56
/tmp/php-fpm.strace.997:exit_group(78)                          = ?

Thanks,
Justin

------------------------------------------------------------------------
[2012-05-23 22:51:57] f...@php.net

I've attached a real patch to this bug report.

Can you please test it ?

thx
++ Jerome

------------------------------------------------------------------------
[2012-05-23 22:50:51] f...@php.net

The following patch has been added/updated:

Patch Name: bug62033.patch
Revision:   1337813451
URL:        
https://bugs.php.net/patch-display.php?bug=62033&patch=bug62033.patch&revision=1337813451

------------------------------------------------------------------------
[2012-05-23 22:10:59] f...@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

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=62033


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62033&edit=1

Reply via email to