Welcome! Log In Create A New Profile

Advanced

troubleshooting php-fpm SEGFAULT on php-fpm (re)launch via sysinit ?

Posted by pgnd 
I run php-fpm on linux/64.

It's built/installed from php 5.4.5-dev source.

It launches using a system init.d (/etc/init.d/php-fpm). The start cmd is:

/sbin/startproc /usr/local/php5/sbin/php-fpm --fpm-config
/usr/local/etc/php5/php-fpm.conf

Once launched, php-fpm runs - without apparent issue.

~10%-ish of the time, (re)start using the sysinit fails with a php-fpm
SEGFAULT.

on fail, @ console I see

Starting php-fpm startproc: signal catched /usr/local/php5/sbin/php-fpm:
Segmentation fault

and @ syslog,

Jul 13 08:54:18 svr kernel: [473814.362413] php-fpm[2812]: segfault at
7f1f56adf338 ip 00007f1f5f1d639c sp 00007fff171c6bf0 error 4 in
ld-2.14.1.so[7f1f5f1c8000+20000]

I suspect -- as yet unproven -- that the problem lies with not all
previously-running php-fom children/listeners being properly killed off at
(re)start.

Starting to troubleshoot this, 1st, I've 2 questions:

(1) Is it recommended to use the OS launch system -- namely /sbin/startproc
-- to launch the php-fpm instance? Or, should it be directly exec'd?
(2) What's the proper way to ensure that all php-fpm master+children are
properly terminated prior to (re)launch?

These, and variants of them

/sbin/killproc -TERM /usr/local/php5/sbin/php-fpm
killall /php-fpm &>/dev/null
ps -ef | awk '/php-fpm/ && !/php-fpm-custom/ && !/kill/ && !/awk/ {print
$2}' | xargs -r kill -9 &>/dev/null

each seem to work consistently @console, but intermittently when using the
init system.

thanks.
I've recently seen the same issue and after lots of testing found it was
due to the way and time it takes for the stop script to kill the child
processes.

As a test try the following:

service php-fpm stop
wait 5seconds
service php-fpm start

If you can do the above over and over again then you are simple hitting the
bug in which the restart script is trying to start before the previous
process has fully stopped.

Stuart


On Friday, 13 July 2012 17:12:33 UTC+1, pgnd wrote:
>
> I run php-fpm on linux/64.
>
> It's built/installed from php 5.4.5-dev source.
>
> It launches using a system init.d (/etc/init.d/php-fpm). The start cmd is:
>
> /sbin/startproc /usr/local/php5/sbin/php-fpm --fpm-config
> /usr/local/etc/php5/php-fpm.conf
>
> Once launched, php-fpm runs - without apparent issue.
>
> ~10%-ish of the time, (re)start using the sysinit fails with a php-fpm
> SEGFAULT.
>
> on fail, @ console I see
>
> Starting php-fpm startproc: signal catched
> /usr/local/php5/sbin/php-fpm: Segmentation fault
>
> and @ syslog,
>
> Jul 13 08:54:18 svr kernel: [473814.362413] php-fpm[2812]: segfault at
> 7f1f56adf338 ip 00007f1f5f1d639c sp 00007fff171c6bf0 error 4 in
> ld-2.14.1.so[7f1f5f1c8000+20000]
>
> I suspect -- as yet unproven -- that the problem lies with not all
> previously-running php-fom children/listeners being properly killed off at
> (re)start.
>
> Starting to troubleshoot this, 1st, I've 2 questions:
>
> (1) Is it recommended to use the OS launch system -- namely
> /sbin/startproc -- to launch the php-fpm instance? Or, should it be
> directly exec'd?
> (2) What's the proper way to ensure that all php-fpm master+children are
> properly terminated prior to (re)launch?
>
> These, and variants of them
>
> /sbin/killproc -TERM /usr/local/php5/sbin/php-fpm
> killall /php-fpm &>/dev/null
> ps -ef | awk '/php-fpm/ && !/php-fpm-custom/ && !/kill/ && !/awk/ {print
> $2}' | xargs -r kill -9 &>/dev/null
>
> each seem to work consistently @console, but intermittently when using the
> init system.
>
> thanks.
>
>
>
>
Il giorno 23/lug/2012, alle ore 15:47, Stuart Macfarlane ha scritto:

> I've recently seen the same issue and after lots of testing found it was due to the way and time it takes for the stop script to kill the child processes.
>
> As a test try the following:
>
> service php-fpm stop
> wait 5seconds
> service php-fpm start
>
> If you can do the above over and over again then you are simple hitting the bug in which the restart script is trying to start before the previous process has fully stopped.

I does php-fpm stop and start without using restart command but nothing, the trouble is still here
Il giorno 23/lug/2012, alle ore 15:47, Stuart Macfarlane ha scritto:

> I've recently seen the same issue and after lots of testing found it was due to the way and time it takes for the stop script to kill the child processes.
>
> As a test try the following:
>
> service php-fpm stop
> wait 5seconds
> service php-fpm start
>
> If you can do the above over and over again then you are simple hitting the bug in which the restart script is trying to start before the previous process has fully stopped.

I forgot to tell you that I just tried to use spawn-cgi from lighttpd and I've same trouble with segment fault
The other thing you can do is move your php config files to a temp
directory and then test again.

mv /etc/php.d/*.ini /tmp/

Regards,
Stuart

On 23 July 2012 15:10, RedFoxy <redfoxy.darrest@gmail.com> wrote:

>
> Il giorno 23/lug/2012, alle ore 15:47, Stuart Macfarlane ha scritto:
>
> I've recently seen the same issue and after lots of testing found it was
> due to the way and time it takes for the stop script to kill the child
> processes.
>
> As a test try the following:
>
> service php-fpm stop
> wait 5seconds
> service php-fpm start
>
> If you can do the above over and over again then you are simple hitting
> the bug in which the restart script is trying to start before the previous
> process has fully stopped.
>
>
> I does php-fpm stop and start without using restart command but nothing,
> the trouble is still here
>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 261
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready