php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69865 php-fpm does not close stderr when using syslog
Submitted: 2015-06-17 21:30 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: whissi at whissi dot de Assigned:
Status: Closed Package: FPM related
PHP Version: 5.6.10 OS: Linux
Private report: No CVE-ID:
 [2015-06-17 21:30 UTC] 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]


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-23 00:25 UTC] whissi at whissi dot de
PR php-src/1432 fixes the problem for me. Thank you Michael!
 [2017-01-23 16:57 UTC] krakjoe@php.net
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
 [2017-01-23 16:57 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Fri Apr 28 14:01:35 2017 UTC