Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 428194

Summary: dev-lang/php-5.4.5 : php-fpm hangs when trying to start the service
Product: Gentoo Linux Reporter: Guillaume Castagnino <casta>
Component: [OLD] ServerAssignee: PHP Bugs <php-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugs.php.net/bug.php?id=62726
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: php-fpm.conf
strace -f /usr/lib/php5.4/bin/php-fpm -y /etc/php/fpm-php5.4/php-fpm.conf -g /var/run/php-fpm-php5.4.pid

Description Guillaume Castagnino 2012-07-26 15:09:31 UTC
After upgrading to php-5.4.5, php-fpm init script does not background, and hang indefinitely.
If I issue a Ctrl-C in the terminal, the init script release the terminal and php stay running !

# /etc/init.d/php-fpm start
 * Caching service dependencies ... [ ok ]
 * Starting PHP FastCGI Process Manager ...
^C * php-fpm: caught SIGINT, aborting
 * start-stop-daemon: caught SIGINT, aborting

# ps |grep php
root     28746  0.0  0.2  95132  9720 ?        Ss   17:02   0:00 /usr/lib/php5.4/bin/php-fpm -y /etc/php/fpm-php5.4/php-fpm.conf -g /var/run/php-fpm-php5.4.pid
root     28747  0.0  0.1 103752  5600 ?        Ss   17:02   0:00  \_ php-fpm: master process (/etc/php/fpm-php5.4/php-fpm.conf)                                    
php      28748  0.0  0.1 103752  6756 ?        S    17:02   0:00      \_ php-fpm: pool www                                                                             
php      28749  0.0  0.1 103752  4596 ?        S    17:02   0:00      \_ php-fpm: pool www 



Downgrading to 5.4.4 fixes this: the init scripts backgrounds correctly.


emerge --info:

Portage 2.2.0_alpha120 (default/linux/amd64/10.0/desktop, gcc-4.6.3, glibc-2.15-r2, 3.4.5-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.4.5-gentoo-x86_64-Intel-R-_Core-TM-_i5_CPU_760_@_2.80GHz-with-gentoo-2.1
Timestamp of tree: Thu, 26 Jul 2012 14:15:02 +0000
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.10.5
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.11.6, 1.12.2
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.5 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo gcpan_overlay local xwing
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -mtune=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -mtune=native -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildsyspkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch parse-eapi-ebuild-head preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ ftp://mirror.switch.ch/mirror/gentoo/     http://trumpetti.atm.tut.fi/gentoo/ http://mirror.ovh.net/gentoo-distfiles/ http://gentoo.tiscali.nl/"
LANG="fr_FR.UTF-8"
LC_ALL="fr_FR.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--sort-common"
LINGUAS="fr"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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="/usr/local/portage/gcpan-portage /usr/local/portage/local-portage /var/lib/layman/xwing"
SYNC="rsync://rsync.fr.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi additions alsa amd64 bash-completion branding bzip2 cairo caps cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvb dvd dvdnav dvdr emboss encode exif extensions firefox flac fontconfig fortran fr g3dvl gif gles gles2 gpm gtk iconv idn iproute2 ipv6 ithreads jpeg kde lcms libkms libnotify live llvm lzma mad matroska minizip mmx mng modules mozilla mp3 mp4 mpeg mudflap multilib ncurses network nls nptl nsplugin ofx ogg opengl openmp openssl pam pango pcre pdf png policykit ppds pppd qt3support qt4 raster rdesktop readline sasl scanner semantic-desktop session spell sse sse2 sse3 sse4_1 ssl ssse3 startup-notification svg tcpd theora threads tiff truetype udev udisks unicode upower usb v4l v4l2 vaapi vdpau vim-pager vim-syntax vnc vorbis x264 xattr xcb xml xorg xv xvid xvmc zip zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" 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 ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="fr" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi gzip headers_more limit_req limit_conn map proxy realip referer rewrite stub_status upstream_ip_hash userid" PHP_TARGETS="php5-4" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nouveau" 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, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

dev-lang/php-5.4.5 was built with the following:
USE="bzip2 cli crypt ctype curl exif fileinfo filter fpm ftp gd hash iconv imap ipv6 json ldap ldap-sasl mhash (multilib) nls pdo phar posix postgres readline session simplexml soap sockets spell ssl threads tokenizer truetype unicode xml zip zlib -apache2 -bcmath -berkdb -calendar -cdb -cgi -cjk -curlwrappers -debug -doc -embed -enchant -firebird -flatfile (-frontbase) -gdbm -gmp -inifile -intl -iodbc -kerberos (-kolab) -libedit -mssql -mysql -mysqli -mysqlnd -oci8-instant-client -odbc -pcntl -pic -qdbm -recode -sharedmem -snmp -sqlite3 (-sybase-ct) -sysvipc -tidy -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl"
Comment 1 Ole Markus With (RETIRED) gentoo-dev 2012-07-26 19:05:30 UTC
This sounds like an issue I had as well. For me it did not detatch when I had set the number of workers really high (500). Not only did fpm fail to detach, but it also had to be kill -9'ed in order to stop properly.
When I reduced it to 20, it worked.

Would you mind sharing your php-fpm.conf?
Comment 2 Guillaume Castagnino 2012-07-26 19:43:55 UTC
Created attachment 319328 [details]
php-fpm.conf

Here is the php-fpm.conf. There is a very low number of workers as you can see. This conf works perfectly well with php 5.4.4.

I confirm I have to kill -9 the process to terminate it.
Comment 3 Ole Markus With (RETIRED) gentoo-dev 2012-07-26 19:49:00 UTC
I'll see if the same thing happens with your config tomorrow. Maybe I can find what is causing this. If I do I have something to bring upstream.

Note that this is not related to the init script, as you will see the same thing happens when you run the php-fpm command outside of the init script. Same command will work with 5.4.4.
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2012-08-02 12:03:23 UTC
With your config, I am unable to reproduce the error. It may have something to do with e.g memory resources available. But I will take this upstream.
Comment 5 Guillaume Castagnino 2012-08-02 12:54:39 UTC
Created attachment 320054 [details]
strace -f /usr/lib/php5.4/bin/php-fpm -y /etc/php/fpm-php5.4/php-fpm.conf -g /var/run/php-fpm-php5.4.pid

Interestingly, I cannot reproduce on my laptop too. This only hangs on my desktop!

I attach a strace of the php-fpm startup. It hangs on the epoll_wait loop at the end of the file, until I "kill -9" the processes. Looks like it's waiting for some event indefinitely.
Comment 6 William Reveal 2012-08-05 12:38:36 UTC
Discovered that a similar problem also exists for php-5.3.15 php-fpm. I started with the init script and worked it back to php-fpm itself hanging. Thought you might like to know.

/usr/lib/php5.3/bin/php-fpm -y /etc/php/fpm-php5.3/php-fpm.conf -g /var/run/php-fpm-php5.3.pid = bleh

Changing the php-fpm.conf file didn't resolve anything for me.

It also is not consistent as maybe once in 20 tries it worked.
Comment 7 Guillaume Castagnino 2012-08-24 13:42:36 UTC
I think this bug can be closed : 5.4.6 seems to have fixed this for me. I do not have this hang anymore after updating.
Someone can confirm ?
Comment 8 Ole Markus With (RETIRED) gentoo-dev 2012-08-24 14:01:41 UTC
(In reply to comment #7)
> I think this bug can be closed : 5.4.6 seems to have fixed this for me. I do
> not have this hang anymore after updating.
> Someone can confirm ?

My test case is also working. Closing.