[php-maint] Bug#801831: php5-fpm reload fails if there are "too many" pools

GALAMBOS Daniel dancsa at dancsa.hu
Wed Oct 14 23:48:05 UTC 2015

Package: php5-fpm
Version: 5.4.45-0+deb7u1 Konsole output


php5-fpm reload fails if there are too many pools defined. There is no
upper limit on pool number, but if the daemon receives a SIGUSR2, the
current socket names are written into environment variable (to
re-acquire later), then execve() is called. With all the unix domain
sockets' paths in the env, execve fails with E2BIG, and php5-fpm exits.

I have tried to raise max stack size, as according to man 2 execve, max
env size is  min(0.25*RLIMIT_STACK, 32 page), but the problem remains,
as upper limit for one env string is 32 pages.

In our system, we tried to use fpm with 6k on-demand pools (most of our
websites are "should exist but no one will ever open it").

PHP should consider sending only FD numbers. If 4/8 bytes are used
instead of paths and IPs, 16k/33k FDs would be the limit (assuming 4k
pagesize), which wouldn't depend on path lengths; socket types and infos
could be acquired after execve. (And we could document it as a
limitation)  Alternatively, before execve, php5-fpm could write this
information into a tempfile, pass the tempfile's path as command line
argument with the execve,  then use that file after reload.

The bug is found in Wheezy, but Jessie should be affected, too.
root at php05:~# uname -a
Linux php05 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u4 x86_64 GNU/Linux
root at php05:~# lsb_release -d
Description:    Debian GNU/Linux 7.9 (wheezy)


More information about the pkg-php-maint mailing list