Bug #69865 [Opn->Csd]: php-fpm does not close stderr when using syslog

From: Date: Mon, 23 Jan 2017 16:57:25 +0000
Subject: Bug #69865 [Opn->Csd]: php-fpm does not close stderr when using syslog
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206897@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69865&edit=1

 ID:                 69865
 Updated by:         krakjoe@php.net
 Reported by:        whissi at whissi dot de
 Summary:            php-fpm does not close stderr when using syslog
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            FPM related
 Operating System:   Linux
 PHP Version:        5.6.10
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=80a851b4dd622f5825e46a7318bdd80123205b02
Log: Fix Bug #69865 php-fpm does not close stderr when using syslog


Previous Comments:
------------------------------------------------------------------------
[2015-11-23 00:25:05] whissi at whissi dot de

PR php-src/1432 fixes the problem for me. Thank you Michael!

------------------------------------------------------------------------
[2015-06-17 21:30:56] whissi at whissi dot de

Description:
------------
Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=548166

When php-fpm uses syslog, php-fpm won't close stderr.

As result you cannot use Python's subprocess module to start/restart php-fpm for example.
That's how I run into that problem:

I tried salt (a configuration management tool) to restart php-fpm, see https://github.com/saltstack/salt/issues/14957

According to http://www.freedesktop.org/software/systemd/man/daemon.html
(9) a daemonized service should connect /dev/null to standard input, output, and error. Can we do
the same with php-fpm?

PS: A similar problem was found with udev which got accepted and fixed, see https://github.com/systemd/systemd/issues/190


The bug is at least present in 5.5.26 and 5.6.10.

Test script:
---------------
In you "php-fpm.conf" set

  error_log = syslog

Now restart php-fpm and verify with something like

  for i in /proc/$(pgrep --uid 0 php-fpm)/fd/*; do echo $i $(readlink $i); done

("--uid 0" to select only the php-fpm master process)

Expected result:
----------------
/proc/6004/fd/0 /dev/null
/proc/6004/fd/1 /dev/null
/proc/6004/fd/2 /dev/null
/proc/6004/fd/3 /tmp/.ZendSem.Fu3Gpo (deleted)
/proc/6004/fd/4 socket:[19110]
/proc/6004/fd/6 socket:[19111]
/proc/6004/fd/7 socket:[19112]
/proc/6004/fd/8 anon_inode:[eventpoll]
/proc/6004/fd/9 socket:[19116]


Actual result:
--------------
/proc/6004/fd/0 /dev/null
/proc/6004/fd/1 /dev/null
/proc/6004/fd/2 /dev/pts/1
/proc/6004/fd/3 /tmp/.ZendSem.Fu3Gpo (deleted)
/proc/6004/fd/4 socket:[19110]
/proc/6004/fd/6 socket:[19111]
/proc/6004/fd/7 socket:[19112]
/proc/6004/fd/8 anon_inode:[eventpoll]
/proc/6004/fd/9 socket:[19116]



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



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


Thread (3 messages)

« previous php.bugs (#206897) next »