Welcome! Log In Create A New Profile

Advanced

500/502 Error using php-fpm/nginx.. Plzz help

Posted by myuniverso.com 
Jérôme Loyet
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 11:52AM
2010/11/7 sonu khizar <khizarsonu@gmail.com>:
> hello brothers...
>
> i check ed log file and i got bunch of this.
> Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
> 18356 (pool default) exited on signal 15 SIGTERM after $..............
>
> what does it mean ...
>
> waiting for reply and thank you in advance

if you're using pm = dynamic, it means that FPM kills one child
process dynamicaly and it's normal

>
> On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
>> Some how my issue is resolved
>>
>> lastly i have done this changes
>> worker_rlimit_nofile=5120000
>> and
>> style='apache-like'
>>
>> but actually i dunno what make my server stable..... :D
>>
>> And Thank you bro.
>>
>> Have a Nice Day.
>>
>> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
>>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
>>>> suppose now m geting 502 page it will keep showing till i reload
>>>> php-fpm..
>>>>
>>>> What will be the reason....
>>>
>>> I'm 99% sure you would find it in error.log if you bothered to look
>>> there. What are your logging settings?
>>>
>>>> can u please give your configuration that u have used (fastcgi_params
>>>> and php-fpm.conf and nginx.conf)........
>>>>
>>>> Please Jonathan & Milan. :'-(
>>>
>>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
>>> can't make any "blind" guess on this issue. You should really check
>>> the error logs to see what happens. If there isn't anything in the
>>> log, try increasing verbosity level.
>>>
>>> If that still does not give anything, maybe the process just dumps the
>>> core, but then it probably gets restarted. Take a look at whether the
>>> PIDs change over time.
>>>
>>> HTH
>>>
>>> Milan B.
>>> http://www.guacosoft.com/njam
>>>
>>
>>
>> --
>> Regards,
>>
>> -- khizar
>> and myuniverso.com team :-)
>>
>
>
> --
> Regards,
>
> -- khizar
> and myuniverso.com team :-)
>
Andrei Nigmatulin
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 12:08PM
On Sunday 07 November 2010 16:49 you wrote:
> 2010/11/7 sonu khizar <khizarsonu@gmail.com>:
> > hello brothers...
> >
> > i check ed log file and i got bunch of this.
> > Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
> > 18356 (pool default) exited on signal 15 SIGTERM after $..............
> >
> > what does it mean ...
> >
> > waiting for reply and thank you in advance
>
> if you're using pm = dynamic, it means that FPM kills one child
> process dynamicaly and it's normal

It's not.

I've just reviewed this part of code. SIQGUIT should be sent here instead.
SIGTERM can cause request to terminate in the middle, which could be a reason
for 502 error. SIGQUIT always wait for request to complete before terminating
worker process.

This is why we have WARNING in the log file for SIGTERM and NOTICE for
SIGQUIT.

WARNING always means something is not good.

I have prepared a patch for 5.3.3 which fixes that and also includes nice
realtime statistics. Hope to be commited in 5.3.4.


>
> > On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
> >> Some how my issue is resolved
> >>
> >> lastly i have done this changes
> >> worker_rlimit_nofile=5120000
> >> and
> >> style='apache-like'
> >>
> >> but actually i dunno what make my server stable..... :D
> >>
> >> And Thank you bro.
> >>
> >> Have a Nice Day.
> >>
> >> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
> >>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
> >>>> suppose now m geting 502 page it will keep showing till i reload
> >>>> php-fpm..
> >>>>
> >>>> What will be the reason....
> >>>
> >>> I'm 99% sure you would find it in error.log if you bothered to look
> >>> there. What are your logging settings?
> >>>
> >>>> can u please give your configuration that u have used (fastcgi_params
> >>>> and php-fpm.conf and nginx.conf)........
> >>>>
> >>>> Please Jonathan & Milan. :'-(
> >>>
> >>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
> >>> can't make any "blind" guess on this issue. You should really check
> >>> the error logs to see what happens. If there isn't anything in the
> >>> log, try increasing verbosity level.
> >>>
> >>> If that still does not give anything, maybe the process just dumps the
> >>> core, but then it probably gets restarted. Take a look at whether the
> >>> PIDs change over time.
> >>>
> >>> HTH
> >>>
> >>> Milan B.
> >>> http://www.guacosoft.com/njam
> >>
> >> --
> >> Regards,
> >>
> >> -- khizar
> >> and myuniverso.com team :-)
> >
> > --
> > Regards,
> >
> > -- khizar
> > and myuniverso.com team :-)

--
Andrei Nigmatulin
GPG PUB KEY 6449830D

Now I lay me down to sleep(3)
Pray the OS my core to keep
If I die before I wake
Pray the Disk my core to take
sonu khizar
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 12:16PM
i have see this php-fpm.log

fpm_unix_init_main(), line 284: getrlimit(nofile): max:1024, cur:1024

1024 is the limit of resources to be utilized

and how to increase this limit.

On 11/7/10, Jérôme Loyet <ml@fatbsd.com> wrote:
> 2010/11/7 sonu khizar <khizarsonu@gmail.com>:
>> hello brothers...
>>
>> i check ed log file and i got bunch of this.
>> Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
>> 18356 (pool default) exited on signal 15 SIGTERM after $..............
>>
>> what does it mean ...
>>
>> waiting for reply and thank you in advance
>
> if you're using pm = dynamic, it means that FPM kills one child
> process dynamicaly and it's normal
>
>>
>> On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
>>> Some how my issue is resolved
>>>
>>> lastly i have done this changes
>>> worker_rlimit_nofile=5120000
>>> and
>>> style='apache-like'
>>>
>>> but actually i dunno what make my server stable..... :D
>>>
>>> And Thank you bro.
>>>
>>> Have a Nice Day.
>>>
>>> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
>>>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
>>>>> suppose now m geting 502 page it will keep showing till i reload
>>>>> php-fpm..
>>>>>
>>>>> What will be the reason....
>>>>
>>>> I'm 99% sure you would find it in error.log if you bothered to look
>>>> there. What are your logging settings?
>>>>
>>>>> can u please give your configuration that u have used (fastcgi_params
>>>>> and php-fpm.conf and nginx.conf)........
>>>>>
>>>>> Please Jonathan & Milan. :'-(
>>>>
>>>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
>>>> can't make any "blind" guess on this issue. You should really check
>>>> the error logs to see what happens. If there isn't anything in the
>>>> log, try increasing verbosity level.
>>>>
>>>> If that still does not give anything, maybe the process just dumps the
>>>> core, but then it probably gets restarted. Take a look at whether the
>>>> PIDs change over time.
>>>>
>>>> HTH
>>>>
>>>> Milan B.
>>>> http://www.guacosoft.com/njam
>>>>
>>>
>>>
>>> --
>>> Regards,
>>>
>>> -- khizar
>>> and myuniverso.com team :-)
>>>
>>
>>
>> --
>> Regards,
>>
>> -- khizar
>> and myuniverso.com team :-)
>>
>


--
Regards,

-- khizar
and myuniverso.com team :-)
sonu khizar
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 12:16PM
i have seen this php-fpm.log

fpm_unix_init_main(), line 284: getrlimit(nofile): max:1024, cur:1024

1024 is the limit of resources to be utilized

and how to increase this limit.

On 11/7/10, Jérôme Loyet <ml@fatbsd.com> wrote:
> 2010/11/7 sonu khizar <khizarsonu@gmail.com>:
>> hello brothers...
>>
>> i check ed log file and i got bunch of this.
>> Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
>> 18356 (pool default) exited on signal 15 SIGTERM after $..............
>>
>> what does it mean ...
>>
>> waiting for reply and thank you in advance
>
> if you're using pm = dynamic, it means that FPM kills one child
> process dynamicaly and it's normal
>
>>
>> On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
>>> Some how my issue is resolved
>>>
>>> lastly i have done this changes
>>> worker_rlimit_nofile=5120000
>>> and
>>> style='apache-like'
>>>
>>> but actually i dunno what make my server stable..... :D
>>>
>>> And Thank you bro.
>>>
>>> Have a Nice Day.
>>>
>>> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
>>>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
>>>>> suppose now m geting 502 page it will keep showing till i reload
>>>>> php-fpm..
>>>>>
>>>>> What will be the reason....
>>>>
>>>> I'm 99% sure you would find it in error.log if you bothered to look
>>>> there. What are your logging settings?
>>>>
>>>>> can u please give your configuration that u have used (fastcgi_params
>>>>> and php-fpm.conf and nginx.conf)........
>>>>>
>>>>> Please Jonathan & Milan. :'-(
>>>>
>>>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
>>>> can't make any "blind" guess on this issue. You should really check
>>>> the error logs to see what happens. If there isn't anything in the
>>>> log, try increasing verbosity level.
>>>>
>>>> If that still does not give anything, maybe the process just dumps the
>>>> core, but then it probably gets restarted. Take a look at whether the
>>>> PIDs change over time.
>>>>
>>>> HTH
>>>>
>>>> Milan B.
>>>> http://www.guacosoft.com/njam
>>>>
>>>
>>>
>>> --
>>> Regards,
>>>
>>> -- khizar
>>> and myuniverso.com team :-)
>>>
>>
>>
>> --
>> Regards,
>>
>> -- khizar
>> and myuniverso.com team :-)
>>
>


--
Regards,

-- khizar
and myuniverso.com team :-)
sonu khizar
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 12:24PM
how to solve this warning/error please tell :'-(

On 11/7/10, Andrei Nigmatulin <andrei.nigmatulin@gmail.com> wrote:
> On Sunday 07 November 2010 16:49 you wrote:
>> 2010/11/7 sonu khizar <khizarsonu@gmail.com>:
>> > hello brothers...
>> >
>> > i check ed log file and i got bunch of this.
>> > Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
>> > 18356 (pool default) exited on signal 15 SIGTERM after $..............
>> >
>> > what does it mean ...
>> >
>> > waiting for reply and thank you in advance
>>
>> if you're using pm = dynamic, it means that FPM kills one child
>> process dynamicaly and it's normal
>
> It's not.
>
> I've just reviewed this part of code. SIQGUIT should be sent here instead.
> SIGTERM can cause request to terminate in the middle, which could be a
> reason
> for 502 error. SIGQUIT always wait for request to complete before
> terminating
> worker process.
>
> This is why we have WARNING in the log file for SIGTERM and NOTICE for
> SIGQUIT.
>
> WARNING always means something is not good.
>
> I have prepared a patch for 5.3.3 which fixes that and also includes nice
> realtime statistics. Hope to be commited in 5.3.4.
>
>
>>
>> > On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
>> >> Some how my issue is resolved
>> >>
>> >> lastly i have done this changes
>> >> worker_rlimit_nofile=5120000
>> >> and
>> >> style='apache-like'
>> >>
>> >> but actually i dunno what make my server stable..... :D
>> >>
>> >> And Thank you bro.
>> >>
>> >> Have a Nice Day.
>> >>
>> >> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
>> >>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
>> >>>> suppose now m geting 502 page it will keep showing till i reload
>> >>>> php-fpm..
>> >>>>
>> >>>> What will be the reason....
>> >>>
>> >>> I'm 99% sure you would find it in error.log if you bothered to look
>> >>> there. What are your logging settings?
>> >>>
>> >>>> can u please give your configuration that u have used (fastcgi_params
>> >>>> and php-fpm.conf and nginx.conf)........
>> >>>>
>> >>>> Please Jonathan & Milan. :'-(
>> >>>
>> >>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
>> >>> can't make any "blind" guess on this issue. You should really check
>> >>> the error logs to see what happens. If there isn't anything in the
>> >>> log, try increasing verbosity level.
>> >>>
>> >>> If that still does not give anything, maybe the process just dumps the
>> >>> core, but then it probably gets restarted. Take a look at whether the
>> >>> PIDs change over time.
>> >>>
>> >>> HTH
>> >>>
>> >>> Milan B.
>> >>> http://www.guacosoft.com/njam
>> >>
>> >> --
>> >> Regards,
>> >>
>> >> -- khizar
>> >> and myuniverso.com team :-)
>> >
>> > --
>> > Regards,
>> >
>> > -- khizar
>> > and myuniverso.com team :-)
>
> --
> Andrei Nigmatulin
> GPG PUB KEY 6449830D
>
> Now I lay me down to sleep(3)
> Pray the OS my core to keep
> If I die before I wake
> Pray the Disk my core to take
>


--
Regards,

-- khizar
and myuniverso.com team :-)
Dennis J.
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 12:30PM
On 11/07/2010 05:49 PM, Jérôme Loyet wrote:
> 2010/11/7 sonu khizar<khizarsonu@gmail.com>:
>> hello brothers...
>>
>> i check ed log file and i got bunch of this.
>> Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
>> 18356 (pool default) exited on signal 15 SIGTERM after $..............
>>
>> what does it mean ...
>>
>> waiting for reply and thank you in advance
> if you're using pm = dynamic, it means that FPM kills one child
> process dynamicaly and it's normal
>
If this is normal no warning should be written to the log.

Regards,
Dennis
Kiall Mac Innes
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 12:30PM
I'm pretty sure you were told earlier in this thread ;) at the very least
you were told to check if the limit was 1024 and if so, raise it.

Also ... its been all of about 10 minutes .. people aren't here to do
everything for you! Re-read the earlier posts, then do some Googling...
On 7 Nov 2010 17:23, "sonu khizar" <khizarsonu@gmail.com> wrote:
> how to solve this warning/error please tell :'-(
>
> On 11/7/10, Andrei Nigmatulin <andrei.nigmatulin@gmail.com> wrote:
>> On Sunday 07 November 2010 16:49 you wrote:
>>> 2010/11/7 sonu khizar <khizarsonu@gmail.com>:
>>> > hello brothers...
>>> >
>>> > i check ed log file and i got bunch of this.
>>> > Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
>>> > 18356 (pool default) exited on signal 15 SIGTERM after $..............
>>> >
>>> > what does it mean ...
>>> >
>>> > waiting for reply and thank you in advance
>>>
>>> if you're using pm = dynamic, it means that FPM kills one child
>>> process dynamicaly and it's normal
>>
>> It's not.
>>
>> I've just reviewed this part of code. SIQGUIT should be sent here
instead.
>> SIGTERM can cause request to terminate in the middle, which could be a
>> reason
>> for 502 error. SIGQUIT always wait for request to complete before
>> terminating
>> worker process.
>>
>> This is why we have WARNING in the log file for SIGTERM and NOTICE for
>> SIGQUIT.
>>
>> WARNING always means something is not good.
>>
>> I have prepared a patch for 5.3.3 which fixes that and also includes nice
>> realtime statistics. Hope to be commited in 5.3.4.
>>
>>
>>>
>>> > On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
>>> >> Some how my issue is resolved
>>> >>
>>> >> lastly i have done this changes
>>> >> worker_rlimit_nofile=5120000
>>> >> and
>>> >> style='apache-like'
>>> >>
>>> >> but actually i dunno what make my server stable..... :D
>>> >>
>>> >> And Thank you bro.
>>> >>
>>> >> Have a Nice Day.
>>> >>
>>> >> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
>>> >>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
>>> >>>> suppose now m geting 502 page it will keep showing till i reload
>>> >>>> php-fpm..
>>> >>>>
>>> >>>> What will be the reason....
>>> >>>
>>> >>> I'm 99% sure you would find it in error.log if you bothered to look
>>> >>> there. What are your logging settings?
>>> >>>
>>> >>>> can u please give your configuration that u have used
(fastcgi_params
>>> >>>> and php-fpm.conf and nginx.conf)........
>>> >>>>
>>> >>>> Please Jonathan & Milan. :'-(
>>> >>>
>>> >>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
>>> >>> can't make any "blind" guess on this issue. You should really check
>>> >>> the error logs to see what happens. If there isn't anything in the
>>> >>> log, try increasing verbosity level.
>>> >>>
>>> >>> If that still does not give anything, maybe the process just dumps
the
>>> >>> core, but then it probably gets restarted. Take a look at whether
the
>>> >>> PIDs change over time.
>>> >>>
>>> >>> HTH
>>> >>>
>>> >>> Milan B.
>>> >>> http://www.guacosoft.com/njam
>>> >>
>>> >> --
>>> >> Regards,
>>> >>
>>> >> -- khizar
>>> >> and myuniverso.com team :-)
>>> >
>>> > --
>>> > Regards,
>>> >
>>> > -- khizar
>>> > and myuniverso.com team :-)
>>
>> --
>> Andrei Nigmatulin
>> GPG PUB KEY 6449830D
>>
>> Now I lay me down to sleep(3)
>> Pray the OS my core to keep
>> If I die before I wake
>> Pray the Disk my core to take
>>
>
>
> --
> Regards,
>
> -- khizar
> and myuniverso.com team :-)
Jérôme Loyet
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 01:46PM
2010/11/7 Andrei Nigmatulin <andrei.nigmatulin@gmail.com>:
> On Sunday 07 November 2010 16:49 you wrote:
>> 2010/11/7 sonu khizar <khizarsonu@gmail.com>:
>> > hello brothers...
>> >
>> > i check ed log file and i got bunch of this.
>> > Nov 07 22:41:22.056535 [WARNING] fpm_children_bury(), line 215: child
>> > 18356 (pool default) exited on signal 15 SIGTERM after $..............
>> >
>> > what does it mean ...
>> >
>> > waiting for reply and thank you in advance
>>
>> if you're using pm = dynamic, it means that FPM kills one child
>> process dynamicaly and it's normal
>
> It's not.

yes you're right I did review the code too quickly, my mistake.

In fact there is no warning written to log when a child is killed by
dynamic process management. It shows:

>
> I've just reviewed this part of code. SIQGUIT should be sent here instead..
> SIGTERM can cause request to terminate in the middle, which could be a reason
> for 502 error. SIGQUIT always wait for request to complete before terminating
> worker process.

In fact, sending SIGQUIT (soft kill) or SIGTERM (hard kill) is the
same as it's supposed to be sent on a idle child. But in a high loaded
environment, it could be problematic. Here is a patch I'm about to
apply, is this how you were about to do it ?

Index: fpm_process_ctl.c
===================================================================
--- fpm_process_ctl.c (révision 305170)
+++ fpm_process_ctl.c (copie de travail)
@@ -143,6 +143,9 @@
case FPM_PCTL_CONT :
s = SIGCONT;
break;
+ case FPM_PCTL_QUIT :
+ s = SIGQUIT;
+ break;
default :
break;
}
@@ -358,7 +361,7 @@

if (idle > wp->config->pm_max_spare_servers &&
last_idle_child) {
last_idle_child->idle_kill = 1;
- fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_TERM);
+ fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_QUIT);
wp->idle_spawn_rate = 1;
continue;
}
Index: fpm_process_ctl.h
===================================================================
--- fpm_process_ctl.h (révision 305170)
+++ fpm_process_ctl.h (copie de travail)
@@ -38,7 +38,8 @@
enum {
FPM_PCTL_TERM,
FPM_PCTL_STOP,
- FPM_PCTL_CONT
+ FPM_PCTL_CONT,
+ FPM_PCTL_QUIT
};

#endif


>
> This is why we have WARNING in the log file for SIGTERM and NOTICE for
> SIGQUIT.
>
> WARNING always means something is not good.
>
> I have prepared a patch for 5.3.3 which fixes that and also includes nice
> realtime statistics. Hope to be commited in 5.3.4.

It would be great to include it before releasing the next 5.3.4
release. Where can I find it please ?

>
>
>>
>> > On 11/6/10, sonu khizar <khizarsonu@gmail.com> wrote:
>> >> Some how my issue is resolved
>> >>
>> >> lastly i have done this changes
>> >> worker_rlimit_nofile=5120000
>> >> and
>> >> style='apache-like'
>> >>
>> >> but actually i dunno what make my server stable..... :D
>> >>
>> >> And Thank you bro.
>> >>
>> >> Have a Nice Day.
>> >>
>> >> On 11/6/10, Milan Babuskov <milan.babuskov@gmail.com> wrote:
>> >>> On Nov 6, 8:14 am, sonu khizar <khizars...@gmail.com> wrote:
>> >>>> suppose now m geting 502 page it will keep showing till i reload
>> >>>> php-fpm..
>> >>>>
>> >>>> What will be the reason....
>> >>>
>> >>> I'm 99% sure you would find it in error.log if you bothered to look
>> >>> there. What are your logging settings?
>> >>>
>> >>>> can u please give your configuration that u have used (fastcgi_params
>> >>>> and php-fpm.conf and nginx.conf)........
>> >>>>
>> >>>> Please Jonathan & Milan. :'-(
>> >>>
>> >>> I really don't use php-fpm, only nginx. I run PHP with Apache. So, I
>> >>> can't make any "blind" guess on this issue. You should really check
>> >>> the error logs to see what happens. If there isn't anything in the
>> >>> log, try increasing verbosity level.
>> >>>
>> >>> If that still does not give anything, maybe the process just dumps the
>> >>> core, but then it probably gets restarted. Take a look at whether the
>> >>> PIDs change over time.
>> >>>
>> >>> HTH
>> >>>
>> >>> Milan B.
>> >>> http://www.guacosoft.com/njam
>> >>
>> >> --
>> >> Regards,
>> >>
>> >> -- khizar
>> >> and myuniverso.com team :-)
>> >
>> > --
>> > Regards,
>> >
>> > -- khizar
>> > and myuniverso.com team :-)
>
> --
> Andrei Nigmatulin
> GPG PUB KEY 6449830D
>
> Now I lay me down to sleep(3)
> Pray the OS my core to keep
> If I die before I wake
> Pray the Disk my core to take
>
Andrei Nigmatulin
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 02:28PM
On Sunday 07 November 2010 18:45 you wrote:
> yes you're right I did review the code too quickly, my mistake.
>
> In fact there is no warning written to log when a child is killed by
>
> dynamic process management. It shows:
> > I've just reviewed this part of code. SIQGUIT should be sent here
> > instead. SIGTERM can cause request to terminate in the middle, which
> > could be a reason for 502 error. SIGQUIT always wait for request to
> > complete before terminating worker process.
>
> In fact, sending SIGQUIT (soft kill) or SIGTERM (hard kill) is the
> same as it's supposed to be sent on a idle child. But in a high loaded
> environment, it could be problematic. Here is a patch I'm about to
> apply, is this how you were about to do it ?
>
> Index: fpm_process_ctl.c
> ===================================================================
> --- fpm_process_ctl.c (révision 305170)
> +++ fpm_process_ctl.c (copie de travail)
> @@ -143,6 +143,9 @@
> case FPM_PCTL_CONT :
> s = SIGCONT;
> break;
> + case FPM_PCTL_QUIT :
> + s = SIGQUIT;
> + break;
> default :
> break;
> }
> @@ -358,7 +361,7 @@
>
> if (idle > wp->config->pm_max_spare_servers &&
> last_idle_child) {
> last_idle_child->idle_kill = 1;
> - fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_TERM);
> + fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_QUIT);
> wp->idle_spawn_rate = 1;
> continue;
> }
> Index: fpm_process_ctl.h
> ===================================================================
> --- fpm_process_ctl.h (révision 305170)
> +++ fpm_process_ctl.h (copie de travail)
> @@ -38,7 +38,8 @@
> enum {
> FPM_PCTL_TERM,
> FPM_PCTL_STOP,
> - FPM_PCTL_CONT
> + FPM_PCTL_CONT,
> + FPM_PCTL_QUIT
> };
>
> #endif
>

It's absolutely correct.


> > This is why we have WARNING in the log file for SIGTERM and NOTICE for
> > SIGQUIT.
> >
> > WARNING always means something is not good.
> >
> > I have prepared a patch for 5.3.3 which fixes that and also includes nice
> > realtime statistics. Hope to be commited in 5.3.4.
>
> It would be great to include it before releasing the next 5.3.4
> release. Where can I find it please ?

Attached.

Please note, there are lot of other things in the patch, I'm too lazy to split
out things related only to fpm_stats module.

Configuration is simple:

http_stats = 127.0.0.1:9001

Which means, fpm master process will serve you with two pages: /stats.txt for
your eyes and /stats.json for computer. The latter supposed to be used for
shiny live graphics page on html/js/svg/whatever.

The "lq" stands for listening queue. This is one of most important things to
watch on when running heavily loaded sites.

Currently there is support for tcp sockets for linux with kernel >= 2.6.24.

Also it works in freebsd (tested on 7.0 with tcp sockets, but I beleive should
work well on unix sockets and other bsd versions).

Anyway, If you know how to improve support for querying listening queue on
other systems/sockets please share it with me.

"avg" stands for average. It's the same algorithms as used in system load
average - first number is an average for 1 minute, second for 5 and third for
15.

I didn't like fpm_status.c module because it locked down with availability of
at least one php worker in the pool. Thus if all workers in the pool are busy
you can not get statistics on them.


Any feedback is very appreciated.




--
Andrei Nigmatulin
GPG PUB KEY 6449830D

Now I lay me down to sleep(3)
Pray the OS my core to keep
If I die before I wake
Pray the Disk my core to take
Jérôme Loyet
Re: 500/502 Error using php-fpm/nginx.. Plzz help
November 07, 2010 02:52PM
2010/11/7 Andrei Nigmatulin <andrei.nigmatulin@gmail.com>:
> On Sunday 07 November 2010 18:45 you wrote:
>> yes you're right I did review the code too quickly, my mistake.
>>
>> In fact there is no warning written to log when a child is killed by
>>
>> dynamic process management. It shows:
>> > I've just reviewed this part of code. SIQGUIT should be sent here
>> > instead. SIGTERM can cause request to terminate in the middle, which
>> > could be a reason for 502 error. SIGQUIT always wait for request to
>> > complete before terminating worker process.
>>
>> In fact, sending SIGQUIT (soft kill) or SIGTERM (hard kill) is the
>> same as it's supposed to be sent on a idle child. But in a high loaded
>> environment, it could be problematic. Here is a patch I'm about to
>> apply, is this how you were about to do it ?
>>
>> Index: fpm_process_ctl.c
>> ===================================================================
>> --- fpm_process_ctl.c   (révision 305170)
>> +++ fpm_process_ctl.c   (copie de travail)
>> @@ -143,6 +143,9 @@
>>                 case FPM_PCTL_CONT :
>>                         s = SIGCONT;
>>                         break;
>> +               case FPM_PCTL_QUIT :
>> +                       s = SIGQUIT;
>> +                       break;
>>                 default :
>>                         break;
>>         }
>> @@ -358,7 +361,7 @@
>>
>>                 if (idle > wp->config->pm_max_spare_servers &&
>> last_idle_child) {
>>                         last_idle_child->idle_kill = 1;
>> -                       fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_TERM);
>> +                       fpm_pctl_kill(last_idle_child->pid, FPM_PCTL_QUIT);
>>                         wp->idle_spawn_rate = 1;
>>                         continue;
>>                 }
>> Index: fpm_process_ctl.h
>> ===================================================================
>> --- fpm_process_ctl.h   (révision 305170)
>> +++ fpm_process_ctl.h   (copie de travail)
>> @@ -38,7 +38,8 @@
>>  enum {
>>         FPM_PCTL_TERM,
>>         FPM_PCTL_STOP,
>> -       FPM_PCTL_CONT
>> +       FPM_PCTL_CONT,
>> +       FPM_PCTL_QUIT
>>  };
>>
>>  #endif
>>
>
> It's absolutely correct.

There was a missing change in fpm_children_bury() from fpm_children.c

it's been commited in revision 305173 and 305174

http://svn.php.net/viewvc?view=revision&revision=305173
http://svn.php.net/viewvc?view=revision&revision=305174

khizarsonu at gmail dot com, you should test it to check if it
corrects your problem.

>
>
>> > This is why we have WARNING in the log file for SIGTERM and NOTICE for
>> > SIGQUIT.
>> >
>> > WARNING always means something is not good.
>> >
>> > I have prepared a patch for 5.3.3 which fixes that and also includes nice
>> > realtime statistics. Hope to be commited in 5.3.4.
>>
>> It would be great to include it before releasing the next 5.3.4
>> release. Where can I find it please ?
>
> Attached.
>
> Please note, there are lot of other things in the patch, I'm too lazy to split
> out things related only to fpm_stats module.
>
> Configuration is simple:
>
> http_stats = 127.0.0.1:9001
>
> Which means, fpm master process will serve you with two pages: /stats.txt for
> your eyes and /stats.json for computer. The latter supposed to be used for
> shiny live graphics page on html/js/svg/whatever.
>
> The "lq" stands for listening queue. This is one of most important things to
> watch on when running heavily loaded sites.
>
> Currently there is support for tcp sockets for linux with kernel >= 2.6..24.
>
> Also it works in freebsd (tested on 7.0 with tcp sockets, but I beleive should
> work well on unix sockets and other bsd versions).
>
> Anyway, If you know how to improve support for querying listening queue on
> other systems/sockets please share it with me.
>
> "avg" stands for average. It's the same algorithms as used in system load
> average - first number is an average for 1 minute, second for 5 and third for
> 15.
>
> I didn't like fpm_status.c module because it locked down with availability of
> at least one php worker in the pool. Thus if all workers in the pool are busy
> you can not get statistics on them.
>
>
> Any feedback is very appreciated.

great :)
there is a lot to tell and we should not talk about this on this
thread in order to not mix problems.
Maybe you should open a bug report to ask for a new request with your
patch, it's a good place to start.

++ Jerome

>
>
>
>
> --
> Andrei Nigmatulin
> GPG PUB KEY 6449830D
>
> Now I lay me down to sleep(3)
> Pray the OS my core to keep
> If I die before I wake
> Pray the Disk my core to take
>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready