Topic: "An another FPM instance seems to already listen on" error

/etc/init.d/php-fpm restart
Stopping php-fpm:                                          [FAILED]
Starting php-fpm: [10-Oct-2013 21:24:37] ERROR: An another FPM instance seems to already listen on /home/php-fpm/sock/gosianozka.sock
[10-Oct-2013 21:24:37] ERROR: FPM initialization failed
                                                           [FAILED]

Sometimes I'm unable to restart or reload php-fpm because of such message. It happens once or twice a day. Remi can you fix your init.d script ?

Re: "An another FPM instance seems to already listen on" error

> It happens once or twice a day. Remi can you fix your init.d script ?
Any proposal ?

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: "An another FPM instance seems to already listen on" error

Maybe there should be a small sleep to stop all children, then all children should be killed and process should be restarted.

Re: "An another FPM instance seems to already listen on" error

Not sure if this is the same problem you're having but it seems to me there's a problem with PHP FPM and SIGTERM. And this is has been the case for a little while now.

I’m using Nginx + PHP-FPM on CentOS 6.5 (x86_64) and Scientific Linux 6.5 (x86_64). Both are compiled from src. In particular I use the Remi src rpm “php-5.5.11-1.remi.src.rpm” (http://rpms.famillecollet.com/SRPMS/) to recompile PHP. I’ve been having problems with PHP FPM and SIGTERM for a little while now. At least 5.5.10 & 5.5.11.

In order to start/stop PHP-FPM I use:
  service php-fpm start | stop

When stopping the /etc/init.d/php-fpm script

stop () {
       echo -n $"Stopping $prog: "
       killproc -p ${pidfile} php-fpm
       RETVAL=$?
       echo
       if [ $RETVAL -eq 0 ] ; then
               rm -f ${lockfile} ${pidfile}
       fi
}

calls the killproc function in /etc/init.d/functions which issues kill -TERM $pid >/dev/null 2>&1 (where $pid is the PHP-FPM parent pid). Then the killproc function will check if the pid still exists up to the default 3s delay and if it still exists it will issue a brutal kill -KILL $pid >/dev/null 2>&1

Under certain circumstances (which I haven’t been able to pinpoint yet) the kill -TERM fails to stop properly the PHP-FPM children and parent which leads to the kill -KILL being issued on the parent pid (obviously killing it) and leaves ALL the children processes hanging there. PHP-FPM is then in a non-working state and any attempt to “service php-fpm start” will fail. At that stage only killing all children pids will do.
Nothing shows in the /var/log/error_log file.

I managed to trace a case when the kill -TERM works correctly and a case when it doesn’t by using strace -p <parent_pid>
I then issue a kill -TERM <pid>

When it works
============

# strace -p 13501
Process 13501 attached - interrupt to quit
epoll_wait(11, {}, 47, 544)             = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 962)             = 0
epoll_wait(11, {}, 47, 37)              = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 1000)            = 0
epoll_wait(11, {}, 47, 958)             = 0
epoll_wait(11, {}, 47, 41)              = 0
epoll_wait(11, 29765c0, 47, 1000)       = -1 EINTR (Interrupted system call)
--- SIGTERM (Terminated) @ 0 (0) ---
write(7, "T", 1)                        = 1
rt_sigreturn(0x7)                       = -1 EINTR (Interrupted system call)
epoll_wait(11, {{EPOLLIN, {u32=10266688, u64=10266688}}}, 47, 583) = 1
read(5, "T", 1)                         = 1
write(4, "[28-Apr-2014 09:26:56.839646] DE"..., 92) = 92
write(4, "[28-Apr-2014 09:26:56.839854] NO"..., 92) = 92
write(4, "[28-Apr-2014 09:26:56.840008] DE"..., 103) = 103
kill(13506, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.850839] DE"..., 146) = 146
kill(13505, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.851145] DE"..., 146) = 146
kill(13504, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.851433] DE"..., 146) = 146
kill(13503, SIGTERM)                    = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
write(4, "[28-Apr-2014 09:26:56.852863] DE"..., 146) = 146
kill(13502, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.853181] DE"..., 146) = 146
kill(13522, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.853488] DE"..., 147) = 147
kill(13521, SIGTERM)                    = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
write(4, "[28-Apr-2014 09:26:56.853879] DE"..., 147) = 147
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 147
kill(13520, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.855256] DE"..., 147) = 147
kill(13519, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.855698] DE"..., 147) = 147
kill(13518, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.856035] DE"..., 147) = 147
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 147
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 147
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 147
kill(13517, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.857422] DE"..., 147) = 147
kill(13515, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.857608] DE"..., 147) = 147
kill(13514, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.857868] DE"..., 147) = 147
kill(13513, SIGTERM)                    = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
write(4, "[28-Apr-2014 09:26:56.858757] DE"..., 147) = 147
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 147
kill(13512, SIGTERM)                    = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
write(4, "[28-Apr-2014 09:26:56.859721] DE"..., 147) = 147
kill(13511, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.860023] DE"..., 147) = 147
kill(13510, SIGTERM)                    = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
write(4, "[28-Apr-2014 09:26:56.861769] DE"..., 147) = 147
kill(13509, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.862087] DE"..., 147) = 147
kill(13508, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.862390] DE"..., 147) = 147
kill(13507, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.862621] DE"..., 147) = 147
kill(13525, SIGTERM)                    = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 0
write(4, "[28-Apr-2014 09:26:56.863478] DE"..., 131) = 131
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 131
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 131
kill(13524, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.864442] DE"..., 131) = 131
kill(13523, SIGTERM)                    = 0
write(4, "[28-Apr-2014 09:26:56.864696] DE"..., 131) = 131
write(4, "[28-Apr-2014 09:26:56.864903] DE"..., 105) = 105
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 105
read(5, "C", 1)                         = 1
--- SIGCHLD (Child exited) @ 0 (0) ---
write(7, "C", 1)                        = 1
rt_sigreturn(0x7)                       = 1
write(4, "[28-Apr-2014 09:26:56.865884] DE"..., 92) = 92
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13502
write(4, "[28-Apr-2014 09:26:56.866214] DE"..., 182) = 182
read(6, "", 1023)                       = 0
epoll_ctl(11, EPOLL_CTL_DEL, 6, {EPOLLIN, {u32=43477032, u64=43477032}}) = 0
close(6)                                = 0
read(13, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 13, {EPOLLIN, {u32=43477104, u64=43477104}}) = 0
close(13)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13503
write(4, "[28-Apr-2014 09:26:56.870186] DE"..., 182) = 182
read(12, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 12, {EPOLLIN, {u32=43477352, u64=43477352}}) = 0
close(12)                               = 0
read(15, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 15, {EPOLLIN, {u32=43477424, u64=43477424}}) = 0
close(15)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13504
write(4, "[28-Apr-2014 09:26:56.871258] DE"..., 182) = 182
read(14, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 14, {EPOLLIN, {u32=43477672, u64=43477672}}) = 0
close(14)                               = 0
read(17, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 17, {EPOLLIN, {u32=43477744, u64=43477744}}) = 0
close(17)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13505
write(4, "[28-Apr-2014 09:26:56.871901] DE"..., 182) = 182
read(16, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 16, {EPOLLIN, {u32=43477992, u64=43477992}}) = 0
close(16)                               = 0
read(19, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 19, {EPOLLIN, {u32=43478064, u64=43478064}}) = 0
close(19)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13506
write(4, "[28-Apr-2014 09:26:56.872790] DE"..., 182) = 182
read(18, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 18, {EPOLLIN, {u32=43478312, u64=43478312}}) = 0
close(18)                               = 0
read(21, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 21, {EPOLLIN, {u32=43478384, u64=43478384}}) = 0
close(21)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13507
write(4, "[28-Apr-2014 09:26:56.873684] DE"..., 183) = 183
read(20, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 20, {EPOLLIN, {u32=43478632, u64=43478632}}) = 0
close(20)                               = 0
read(23, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 23, {EPOLLIN, {u32=43478704, u64=43478704}}) = 0
close(23)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13508
write(4, "[28-Apr-2014 09:26:56.874670] DE"..., 183) = 183
read(22, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 22, {EPOLLIN, {u32=43478952, u64=43478952}}) = 0
close(22)                               = 0
read(25, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 25, {EPOLLIN, {u32=43479024, u64=43479024}}) = 0
close(25)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13509
write(4, "[28-Apr-2014 09:26:56.875642] DE"..., 183) = 183
read(24, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 24, {EPOLLIN, {u32=43479272, u64=43479272}}) = 0
close(24)                               = 0
read(27, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 27, {EPOLLIN, {u32=43479344, u64=43479344}}) = 0
close(27)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13510
write(4, "[28-Apr-2014 09:26:56.876636] DE"..., 183) = 183
read(26, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 26, {EPOLLIN, {u32=43479592, u64=43479592}}) = 0
close(26)                               = 0
read(29, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 29, {EPOLLIN, {u32=43479664, u64=43479664}}) = 0
close(29)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13511
write(4, "[28-Apr-2014 09:26:56.877652] DE"..., 183) = 183
read(28, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 28, {EPOLLIN, {u32=43479912, u64=43479912}}) = 0
close(28)                               = 0
read(31, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 31, {EPOLLIN, {u32=43479984, u64=43479984}}) = 0
close(31)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13512
write(4, "[28-Apr-2014 09:26:56.878702] DE"..., 183) = 183
read(30, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 30, {EPOLLIN, {u32=43480232, u64=43480232}}) = 0
close(30)                               = 0
read(33, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 33, {EPOLLIN, {u32=43480304, u64=43480304}}) = 0
close(33)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13513
write(4, "[28-Apr-2014 09:26:56.879818] DE"..., 183) = 183
read(32, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 32, {EPOLLIN, {u32=43480552, u64=43480552}}) = 0
close(32)                               = 0
read(35, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 35, {EPOLLIN, {u32=43480624, u64=43480624}}) = 0
close(35)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13514
write(4, "[28-Apr-2014 09:26:56.880941] DE"..., 183) = 183
read(34, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 34, {EPOLLIN, {u32=43480872, u64=43480872}}) = 0
close(34)                               = 0
read(37, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 37, {EPOLLIN, {u32=43480944, u64=43480944}}) = 0
close(37)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13515
write(4, "[28-Apr-2014 09:26:56.882054] DE"..., 183) = 183
read(36, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 36, {EPOLLIN, {u32=43481192, u64=43481192}}) = 0
close(36)                               = 0
read(39, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 39, {EPOLLIN, {u32=43481264, u64=43481264}}) = 0
close(39)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13517
write(4, "[28-Apr-2014 09:26:56.883099] DE"..., 183) = 183
read(38, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 38, {EPOLLIN, {u32=43481512, u64=43481512}}) = 0
close(38)                               = 0
read(41, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 41, {EPOLLIN, {u32=43481584, u64=43481584}}) = 0
close(41)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13518
write(4, "[28-Apr-2014 09:26:56.884293] DE"..., 183) = 183
read(40, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 40, {EPOLLIN, {u32=43481832, u64=43481832}}) = 0
close(40)                               = 0
read(43, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 43, {EPOLLIN, {u32=43481904, u64=43481904}}) = 0
close(43)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13519
write(4, "[28-Apr-2014 09:26:56.885406] DE"..., 183) = 183
read(42, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 42, {EPOLLIN, {u32=43482152, u64=43482152}}) = 0
close(42)                               = 0
read(45, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 45, {EPOLLIN, {u32=43482224, u64=43482224}}) = 0
close(45)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13520
write(4, "[28-Apr-2014 09:26:56.886450] DE"..., 183) = 183
read(44, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 44, {EPOLLIN, {u32=43482472, u64=43482472}}) = 0
close(44)                               = 0
read(47, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 47, {EPOLLIN, {u32=43482544, u64=43482544}}) = 0
close(47)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13521
write(4, "[28-Apr-2014 09:26:56.887576] DE"..., 183) = 183
read(46, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 46, {EPOLLIN, {u32=43482792, u64=43482792}}) = 0
close(46)                               = 0
read(49, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 49, {EPOLLIN, {u32=43482864, u64=43482864}}) = 0
close(49)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13522
write(4, "[28-Apr-2014 09:26:56.888673] DE"..., 183) = 183
read(48, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 48, {EPOLLIN, {u32=43483112, u64=43483112}}) = 0
close(48)                               = 0
read(51, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 51, {EPOLLIN, {u32=43483184, u64=43483184}}) = 0
close(51)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13523
write(4, "[28-Apr-2014 09:26:56.889838] DE"..., 167) = 167
read(50, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 50, {EPOLLIN, {u32=43483432, u64=43483432}}) = 0
close(50)                               = 0
read(53, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 53, {EPOLLIN, {u32=43483504, u64=43483504}}) = 0
close(53)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13524
write(4, "[28-Apr-2014 09:26:56.890811] DE"..., 167) = 167
read(52, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 52, {EPOLLIN, {u32=43483752, u64=43483752}}) = 0
close(52)                               = 0
read(55, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 55, {EPOLLIN, {u32=43483824, u64=43483824}}) = 0
close(55)                               = 0
wait4(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGTERM}], WNOHANG|WSTOPPED, NULL) = 13525
write(4, "[28-Apr-2014 09:26:56.891890] DE"..., 167) = 167
read(54, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 54, {EPOLLIN, {u32=43484072, u64=43484072}}) = 0
close(54)                               = 0
read(57, "", 1023)                      = 0
epoll_ctl(11, EPOLL_CTL_DEL, 57, {EPOLLIN, {u32=43484144, u64=43484144}}) = 0
close(57)                               = 0
write(4, "[28-Apr-2014 09:26:56.892943] NO"..., 93) = 93
unlink("/var/run/php-fpm/php-fpm.pid")  = 0
munmap(0x7fb5c848f000, 1168)            = 0
munmap(0x7fb5c848e000, 1168)            = 0
munmap(0x7fb5c848d000, 1168)            = 0
munmap(0x7fb5c848c000, 1168)            = 0
munmap(0x7fb5c848b000, 1168)            = 0
munmap(0x7fb5c8490000, 120)             = 0
munmap(0x7fb5c8489000, 1168)            = 0


When it doesn’t work
=================

# strace -p 29593
Process 29593 attached - interrupt to quit
epoll_wait(5, {}, 47, 728)              = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 176)              = 0
epoll_wait(5, {}, 47, 824)              = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 172)              = 0
epoll_wait(5, {}, 47, 828)              = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 168)              = 0
epoll_wait(5, 171d650, 47, 832)         = -1 EINTR (Interrupted system call)
--- SIGTERM (Terminated) @ 0 (0) ---
write(4, "T", 1)                        = -1 EPIPE (Broken pipe)
rt_sigreturn(0x4)                       = -1 EINTR (Interrupted system call)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
epoll_wait(5, {}, 47, 563)              = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 163)              = 0
...
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 88)               = 0
epoll_wait(5, {}, 47, 912)              = 0
epoll_wait(5, 171d650, 47, 1000)        = -1 EINTR (Interrupted system call)
--- SIGTERM (Terminated) @ 0 (0) ---
write(4, "T", 1)                        = -1 EPIPE (Broken pipe)
rt_sigreturn(0x4)                       = -1 EINTR (Interrupted system call)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
epoll_wait(5, {}, 47, 954)              = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
...
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, {}, 47, 1000)             = 0
epoll_wait(5, 171d650, 47, 1000)        = -1 EINTR (Interrupted system call)
--- SIGTERM (Terminated) @ 0 (0) ---
write(4, "T", 1)                        = -1 EPIPE (Broken pipe)
rt_sigreturn(0x4)                       = -1 EINTR (Interrupted system call)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
epoll_wait(5, {}, 47, 822)              = 0
epoll_wait(5, {}, 47, 1000)             = 0

It’s clear that when it doesn’t work a kill(<child_pid>, SIGTERM) is never sent and issueing another kill -TERM <pid> just output the same stuff with this EPIPE (Broken pipe)

Note: The kill -TERM used to work just fine. It might have been with PHP 5.4.x. I can’t remember when it started failing exactly but this is stopping us to move back to Nginx + PHP-FPM from Apache 2.2.27 + PHP

Anything you could check?

Re: "An another FPM instance seems to already listen on" error

> I can’t remember when it started failing exactly
This information will be usefull... to dig in the FPM changes

By luck... systemd will improve such issue wink

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

6 (edited by fred_demarcy 2014-04-30 09:30:39)

Re: "An another FPM instance seems to already listen on" error

Hi Remi

I tried to diff all .c files in /sapi/fpm/fpm/ between PHP 5.4.17 (the last PHP 5.4 release i used before moving to PHP 5.5.3) and PHP 5.5.11 and there were very few changes which didn't seem to have any relation to this problem but obviously this is to be taken with a pinch of salt because I have no expertise whatsoever with the PHP src code.

We're going to be stuck on Redhat 6.x (and derivative CentOS 6.x, Scientific Linux 6.x) for a while. I assume systemd will be part of Redhat 7.x and not being able to run properly PHP-FPM 5.5.x on Redhat 6.x systems is a problem...