Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 531354 - dev-lang/php-5.5.19 USE="fpm" - reloading php-fpm fails: ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
Summary: dev-lang/php-5.5.19 USE="fpm" - reloading php-fpm fails: ERROR: unable to bin...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-01 16:25 UTC by Tomáš Mózes
Modified: 2014-12-20 14:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomáš Mózes 2014-12-01 16:25:37 UTC
On a current amd64 system I'm unable to reload php-fpm.

/var/log/php-fpm.log contains:
[01-Dec-2014 14:44:49] NOTICE: Reloading in progress ...
[01-Dec-2014 14:44:49] NOTICE: reloading: execvp("/usr/lib/php5.5/bin/php-fpm", {"/usr/lib/php5.5/bin/php-fpm", "-y", "/etc/php/fpm-php5.5/php-fpm.conf", "-g", "/run/php-fpm.pid"})
[01-Dec-2014 14:44:49] NOTICE: using inherited socket fd=8, "<F0><94><B6>^A"
[01-Dec-2014 14:44:49] NOTICE: using inherited socket fd=8, "<F0><94><B6>^A"
[01-Dec-2014 14:44:49] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
[01-Dec-2014 14:44:49] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
[01-Dec-2014 14:44:49] ERROR: FPM initialization failed
[01-Dec-2014 14:44:49] ERROR: FPM initialization failed

Normally it looks like this:
[28-Nov-2014 11:02:52] NOTICE: Reloading in progress ...
[28-Nov-2014 11:02:52] NOTICE: reloading: execvp("/usr/lib/php5.5/bin/php-fpm", {"/usr/lib/php5.5/bin/php-fpm", "-y", "/etc/php/fpm-php5.
5/php-fpm.conf", "-g", "/run/php-fpm.pid"})
[28-Nov-2014 11:02:52] NOTICE: using inherited socket fd=8, "127.0.0.1:9000"
[28-Nov-2014 11:02:52] NOTICE: using inherited socket fd=8, "127.0.0.1:9000"
[28-Nov-2014 11:02:52] NOTICE: fpm is running, pid 6823

It's strange that this happens on 2 newly installed machines, the year old running machines that were updated to 5.5.19 work fine (same configuration). After downgrading to 5.5.18 it works again correctly.

Portage 2.2.8-r2 (default/linux/amd64/13.0, gcc-4.8.3, glibc-2.19-r1, 3.14.24-gentoo x86_64)
=================================================================
System uname: Linux-3.14.24-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5-2630_0_@_2.30GHz-with-gentoo-2.2
KiB Mem:    10026360 total,   6733588 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Fri, 28 Nov 2014 08:30:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.2_p53
dev-lang/perl:            5.18.2-r2
dev-lang/python:          2.7.7, 3.3.5-r1, 3.4.1
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.69
sys-devel/automake:       1.13.4
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo hydra
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-mtune=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://tux.rainside.sk/gentoo/ http://gentoo.wheel.sk/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/hydra"
USE="acl amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri fortran gdbm iconv mmx modules multilib ncurses nls nptl openmp pam pcre readline session sse sse2 ssl tcpd unicode zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core authz_host dir mime unixd socache_shmcb log_config rewrite vhost_alias log_forensic proxy proxy_fcgi info status deflate filter auth_digest authn_file authz_user access_compat actions alias auth_basic authn_alias authn_anon env expires headers mime_magic negotiation reqtimeout setenvif unique_id version remoteip" APACHE2_MPMS="event" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

# emerge -pvq dev-lang/php
[ebuild     U ] dev-lang/php-5.5.19 [5.5.18] USE="bcmath berkdb bzip2 calendar cli crypt ctype curl fileinfo filter fpm ftp gd gdbm gmp hash iconv intl json mysql mysqli nls opcache pcntl pdo phar posix readline session simplexml soap sockets ssl sysvipc threads tidy tokenizer unicode xml xmlreader xmlrpc xmlwriter zip zlib -apache2 -cdb -cgi -cjk -debug -embed -enchant -exif (-firebird) -flatfile (-frontbase) -imap -inifile -iodbc -ipv6 -kerberos -ldap -ldap-sasl -libedit -libmysqlclient -mhash -mssql -oci8-instant-client -odbc -postgres -qdbm -recode (-selinux) -sharedmem -snmp -spell -sqlite (-sybase-ct) -systemd -truetype -vpx -wddx -xpm -xslt"
Comment 1 Ole Markus With (RETIRED) gentoo-dev 2014-12-02 08:53:04 UTC
Did you create an upstream bug for this? It does not look to be a Gentoo-related issue.
Comment 2 Tomáš Mózes 2014-12-02 09:37:13 UTC
I just tested php-5.5.20_rc1 on amd64, it works ok on both, older machines that got updated to current (except for gcc 4.7) and brand new machines with gcc 4.8.

Checking the NEWS for 5.5.20_rc1, it has lots of php-fpm fixes:

27 Nov 2014, PHP 5.5.20RC1

- Core:
  . Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks).
    (Adam)
  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly 
    triggered). (Julien)
  . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)

- FPM:
  . Fixed bug #68381 (fpm_unix_init_main ignores log_level).
    (David Zuelke, Remi)
  . Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all
    addresses). (Remi)
  . Fixed bug #68421 (access.format='%R' doesn't log ipv6 address). (Remi)
  . Fixed bug #68423 (PHP-FPM will no longer load all pools). (Remi)
  . Fixed bug #68428 (listen.allowed_clients is IPv4 only). (Remi)
  . Fixed bug #68452 (php-fpm man page is oudated). (Remi)
  . Fixed request #68458 (Change pm.start_servers default warning to
    notice). (David Zuelke, Remi)
  . Fixed bug #68463 (listen.allowed_clients can silently result
    in no allowed access). (Remi)
  . Fixed request #68391 (php-fpm conf files loading order).
    (Florian Margaine, Remi)
  . Fixed bug #68478 (access.log don't use prefix). (Remi)

- PDO_pgsql:
  . Fixed bug #66584 (Segmentation fault on statement deallocation) (Matteo)
  . Fixed bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception
  when not in transaction) (Matteo)
  . Fixed bug #68351 (PDO::PARAM_BOOL and ATTR_EMULATE_PREPARES misbehaving)
  (Matteo)

- zlib:
  . Fixed bug #53829 (Compiling PHP with large file support will replace
    function gzopen by gzopen64) (Sascha Kettler, Matteo)
Comment 3 Eric Gisse 2014-12-09 05:27:41 UTC
The problem with this is the set_phpvars() function, specifically how it sets the PHP_FPM_PID option.

Regardless of what is set there, the php-fpm pid file is put into /run/php-fpm rather than /run/, so the openrc checks always go mental.

Fixing this is straight forward. Apply this little patch to /etc/init.d/php-fpm

5c5
<       PHP_FPM_PID="/run/php-fpm/php-fpm-${PHPSLOT}.pid"
---
>       PHP_FPM_PID="/run/php-fpm-${PHPSLOT}.pid"
8c8
<               PHP_FPM_PID="/run/php-fpm/php-fpm.pid"
---
>               PHP_FPM_PID="/run/php-fpm.pid"

This allows me to restart fpm normally, which was causing hell with puppet.
Comment 4 Tomáš Mózes 2014-12-09 06:36:43 UTC
Eric, which version do you have installed?

When I check the init script in version 5.5.19, it already looks like that:
set_phpvars() {
        PHPSLOT=${SVCNAME#php-fpm-}
        PHP_FPM_PID="/run/php-fpm-${PHPSLOT}.pid"
        if [ ${PHPSLOT} = 'php-fpm' ] ; then
                PHPSLOT="$(eselect php show fpm)"
                PHP_FPM_PID="/run/php-fpm.pid"
        fi

        PHP_FPM_CONF="/etc/php/fpm-${PHPSLOT}/php-fpm.conf"
}
Comment 5 László Szalma 2014-12-10 11:55:21 UTC
I'm not sure this bug is the related, but I have a problem:

I have 8 pool declared in php-fpm config.
I start the php-fpm server, I have no error message, not in the log. Reload works, restart works, but only the first 2 pool is started! Yes, I mean, the first two, if i change the order of pools in the fpm config, the first two will listen on the defined ports (netstat -ltpn).

Any package reemerge didn't help, downgradeing to 5.5.18 solved the problem.
Comment 6 Tomáš Mózes 2014-12-19 08:23:53 UTC
Upgrading to 5.5.20 fixed the issue.
Comment 7 László Szalma 2014-12-20 12:38:04 UTC
(In reply to Tomas Mozes from comment #6)
> Upgrading to 5.5.20 fixed the issue.

Relevant information:

https://bugs.php.net/bug.php?id=68423
Comment 8 Ole Markus With (RETIRED) gentoo-dev 2014-12-20 14:41:59 UTC
(In reply to László Szalma from comment #7)
> (In reply to Tomas Mozes from comment #6)
> > Upgrading to 5.5.20 fixed the issue.
> 
> Relevant information:
> 
> https://bugs.php.net/bug.php?id=68423

5.5.20 committed to the tree