You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2021/09/21 07:56:26 UTC

Should dying processes be accounted as active_daemons?

I am just investigating a case where a httpd 2.4.49 gets stuck and as part of the investigation
I am asking myself if we should count processes that die because of MaxRequestsPerChild still count
to active_daemons?
Because if we do like today we may prevent replacement processes to be started while the other processes die, e.g. if
active_daemons hits active_daemons_limit.

Regards

Rüdiger

Re: Should dying processes be accounted as active_daemons?

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Sep 22, 2021 at 8:52 PM Ruediger Pluem <rp...@apache.org> wrote:
>
> On 9/22/21 8:31 AM, Ruediger Pluem wrote:
> >
> >
> > On 9/21/21 9:56 AM, Ruediger Pluem wrote:
> >> I am just investigating a case where a httpd 2.4.49 gets stuck and as part of the investigation
> >> I am asking myself if we should count processes that die because of MaxRequestsPerChild still count
> >> to active_daemons?
> >> Because if we do like today we may prevent replacement processes to be started while the other processes die, e.g. if
> >> active_daemons hits active_daemons_limit.
> >
> > Answering to my own question:
> >
> > We do decrement active_daemons if we shutdown a process because we have too much idle threads, but we don't do it if the child
> > process decides on its own to die because of MaxRequestsPerChild. The below patch shoudl fix this. Opinions?
>
>
> r1893520 / PR65592

Nice, thanks Rüdiger.

Regards;
Yann.

Re: Should dying processes be accounted as active_daemons?

Posted by Ruediger Pluem <rp...@apache.org>.

On 9/22/21 8:31 AM, Ruediger Pluem wrote:
> 
> 
> On 9/21/21 9:56 AM, Ruediger Pluem wrote:
>> I am just investigating a case where a httpd 2.4.49 gets stuck and as part of the investigation
>> I am asking myself if we should count processes that die because of MaxRequestsPerChild still count
>> to active_daemons?
>> Because if we do like today we may prevent replacement processes to be started while the other processes die, e.g. if
>> active_daemons hits active_daemons_limit.
> 
> Answering to my own question:
> 
> We do decrement active_daemons if we shutdown a process because we have too much idle threads, but we don't do it if the child
> process decides on its own to die because of MaxRequestsPerChild. The below patch shoudl fix this. Opinions?


r1893520 / PR65592

Regards

Rüdiger

Re: Should dying processes be accounted as active_daemons?

Posted by Ruediger Pluem <rp...@apache.org>.

On 9/21/21 9:56 AM, Ruediger Pluem wrote:
> I am just investigating a case where a httpd 2.4.49 gets stuck and as part of the investigation
> I am asking myself if we should count processes that die because of MaxRequestsPerChild still count
> to active_daemons?
> Because if we do like today we may prevent replacement processes to be started while the other processes die, e.g. if
> active_daemons hits active_daemons_limit.

Answering to my own question:

We do decrement active_daemons if we shutdown a process because we have too much idle threads, but we don't do it if the child
process decides on its own to die because of MaxRequestsPerChild. The below patch shoudl fix this. Opinions?

Index: server/mpm/event/event.c
===================================================================
--- server/mpm/event/event.c	(revision 1893497)
+++ server/mpm/event/event.c	(working copy)
@@ -3118,6 +3118,10 @@
         }
         ps = &ap_scoreboard_image->parent[i];
         if (ps->pid != 0) {
+            if (ps->quiescing == 1) {
+                ps->quiescing = 2;
+                active_daemons--;
+            }
             for (j = 0; j < threads_per_child; j++) {
                 ws = &ap_scoreboard_image->servers[i][j];
                 status = ws->status;
@@ -3197,7 +3201,6 @@
             ap_mpm_podx_signal(retained->buckets[child_bucket].pod,
                                AP_MPM_PODX_GRACEFUL);
             retained->idle_spawn_rate[child_bucket] = 1;
-            active_daemons--;
         } else {
             ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, ap_server_conf,
                          "Not shutting down child: total daemons %d / "


Regards

Rüdiger