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

 ID:                 62033
 User updated by:    js at justinsamuel dot com
 Reported by:        js at justinsamuel dot com
 Summary:            php-fpm exits with status 0 on some failures to
                     start
-Status:             Feedback
+Status:             Assigned
 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:

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


Previous Comments:
------------------------------------------------------------------------
[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

------------------------------------------------------------------------
[2012-05-23 20:54:11] js at justinsamuel dot com

For simplicity here I'm going to focus on 5.3 instead of 5.4.

I've tried with the following:
* compiled from source (php.net tarballs) on Ubuntu 12.04
* compiled from source (php.net tarballs) on Debian 6
* Ubuntu 12.04's current php5-fpm package
* CentOS 6 with current php53u-fpm package from IUS

Here's the -tt info:

# /opt/test/php5.3/sbin/php-fpm --fpm-config /etc/php-test/fpm.conf -tt
[23-May-2012 13:07:26] NOTICE: [General]
[23-May-2012 13:07:26] NOTICE:  pid = /var/run/php5.3-test.pid
[23-May-2012 13:07:26] NOTICE:  error_log = /var/log/php5.3-test.log
[23-May-2012 13:07:26] NOTICE:  syslog.ident = php-fpm
[23-May-2012 13:07:26] NOTICE:  syslog.facility = 24
[23-May-2012 13:07:26] NOTICE:  log_level = unknown value
[23-May-2012 13:07:26] NOTICE:  emergency_restart_interval = 0s
[23-May-2012 13:07:26] NOTICE:  emergency_restart_threshold = 0
[23-May-2012 13:07:26] NOTICE:  process_control_timeout = 0s
[23-May-2012 13:07:26] NOTICE:  process.max = 0
[23-May-2012 13:07:26] NOTICE:  daemonize = yes
[23-May-2012 13:07:26] NOTICE:  rlimit_files = 0
[23-May-2012 13:07:26] NOTICE:  rlimit_core = 0
[23-May-2012 13:07:26] NOTICE:  events.mechanism = epoll
[23-May-2012 13:07:26] NOTICE:  
[23-May-2012 13:07:26] NOTICE: [example.com]
[23-May-2012 13:07:26] NOTICE:  prefix = undefined
[23-May-2012 13:07:26] NOTICE:  user = fakeuser
[23-May-2012 13:07:26] NOTICE:  group = fakegroup
[23-May-2012 13:07:26] NOTICE:  listen = /tmp/php5.3-test.sock
[23-May-2012 13:07:26] NOTICE:  listen.backlog = 128
[23-May-2012 13:07:26] NOTICE:  listen.owner = root
[23-May-2012 13:07:26] NOTICE:  listen.group = root
[23-May-2012 13:07:26] NOTICE:  listen.mode = 0700
[23-May-2012 13:07:26] NOTICE:  listen.allowed_clients = undefined
[23-May-2012 13:07:26] NOTICE:  pm = ondemand
[23-May-2012 13:07:26] NOTICE:  pm.max_children = 1
[23-May-2012 13:07:26] NOTICE:  pm.start_servers = 0
[23-May-2012 13:07:26] NOTICE:  pm.min_spare_servers = 0
[23-May-2012 13:07:26] NOTICE:  pm.max_spare_servers = 0
[23-May-2012 13:07:26] NOTICE:  pm.process_idle_timeout = 10
[23-May-2012 13:07:26] NOTICE:  pm.max_requests = 0
[23-May-2012 13:07:26] NOTICE:  pm.status_path = undefined
[23-May-2012 13:07:26] NOTICE:  ping.path = undefined
[23-May-2012 13:07:26] NOTICE:  ping.response = undefined
[23-May-2012 13:07:26] NOTICE:  access.log = undefined
[23-May-2012 13:07:26] NOTICE:  access.format = undefined
[23-May-2012 13:07:26] NOTICE:  slowlog = undefined
[23-May-2012 13:07:26] NOTICE:  request_slowlog_timeout = 0s
[23-May-2012 13:07:26] NOTICE:  request_terminate_timeout = 0s
[23-May-2012 13:07:26] NOTICE:  rlimit_files = 0
[23-May-2012 13:07:26] NOTICE:  rlimit_core = 0
[23-May-2012 13:07:26] NOTICE:  chroot = undefined
[23-May-2012 13:07:26] NOTICE:  chdir = undefined
[23-May-2012 13:07:26] NOTICE:  catch_workers_output = no
[23-May-2012 13:07:26] NOTICE:  security.limit_extensions = .php .phar
[23-May-2012 13:07:26] NOTICE:  
[23-May-2012 13:07:26] NOTICE: configuration file /etc/php-test/fpm.conf test 
is successful

Here's the version info for builds I've repeated this problem with. I haven't 
had any builds not show show this problem yet.

## on Ubuntu 12.04, built from source
# /opt/test/php5.3/sbin/php-fpm --version
PHP 5.3.13 (fpm-fcgi) (built: May 23 2012 12:21:32)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

## on Ubuntu 12.04, using distro's package
# php5-fpm --version
PHP 5.3.10-1ubuntu3.1 (fpm-fcgi) (built: May  4 2012 02:28:04)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

## on Debian 6, built from source
# /opt/test/php5.3/sbin/php-fpm --version
PHP 5.3.13 (fpm-fcgi) (built: May 23 2012 15:05:00)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

## on CentOS 6, using packages from IUS
# php-fpm --version
PHP 5.3.13 (fpm-fcgi) (built: May  8 2012 15:44:17)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

As a sanity check, I've repeated the problem again on all of the above versions 
with the same config. They all show the same error but exit with 0.

------------------------------------------------------------------------
[2012-05-23 07:36:58] f...@php.net

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


I can't reproduce the problem.

On my side with both up2date sources for 5.3 and 5.4:


root@dev:/home/fat/dev/php-git/php-5.4# ./sapi/fpm/php-fpm ; echo $?
[23-May-2012 09:32:03] ERROR: [pool direct] cannot get uid for user 'fatprout'
[23-May-2012 09:32:03] ERROR: FPM initialization failed
255

root@dev:/home/fat/dev/php-git/php-5.4# ./sapi/fpm/php-fpm ; echo $?
[23-May-2012 09:32:29] ERROR: [pool direct] cannot get gid for group 'fatprout'
[23-May-2012 09:32:29] ERROR: FPM initialization failed
255


which version of PHP are you using ? (sources from php.net you have compiled or 
a package from a distro ?)

Can you send me the result of 
php-fpm --version
php-fpm -tt

thx

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


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