Mailing List Archive

The number of child processes is less than MinSpareThreads.
In the following environment where multiple Listen directives are defined, the number of child processes may temporarily fall below MinSpareThreads after 6 requests are received at the same time and HTTP request processing is completed.
Is this a bug or a specification?

OS : Red Hat Enterprise Linux Server
MPM: worker

httpd.conf:
----------------------------------------------------
Listen 80
Listen 8080

ServerLimit 50
StartServers 5
MinSpareThreads 5
MaxSpareThreads 10
ThreadsPerChild 1
MaxRequestWorkers 50
MaxConnectionsPerChild 0
----------------------------------------------------

compile settings:
----------------------------------------------------
# /opt/apache24/bin/httpd -V
Server version: Apache/2.4.46 (Unix)
Server built: Jan 15 2021 15:05:18
Server's Module Magic Number: 20120211:93
Server loaded: APR 1.7.0, APR-UTIL 1.6.1
Compiled using: APR 1.7.0, APR-UTIL 1.6.1
Architecture: 64-bit
Server MPM: worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_PROC_PTHREAD_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/opt/apache24"
-D SUEXEC_BIN="/opt/apache24/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
----------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: The number of child processes is less than MinSpareThreads. [ In reply to ]
On Thu, Mar 11, 2021 at 9:29 PM motoda.hironori@fujitsu.com
<motoda.hironori@fujitsu.com> wrote:
>
> In the following environment where multiple Listen directives are defined, the number of child processes may temporarily fall below MinSpareThreads after 6 requests are received at the same time and HTTP request processing is completed.
> Is this a bug or a specification?
>
> OS : Red Hat Enterprise Linux Server
> MPM: worker
>
> httpd.conf:
> ----------------------------------------------------
> Listen 80
> Listen 8080
>
> ServerLimit 50
> StartServers 5
> MinSpareThreads 5
> MaxSpareThreads 10
> ThreadsPerChild 1
> MaxRequestWorkers 50
> MaxConnectionsPerChild 0
> ----------------------------------------------------

This is working as designed, the server checks only once per second to
see if processes need to be started or killed based on the current
idle threads.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: The number of child processes is less than MinSpareThreads. [ In reply to ]
If anyone reads this thread, let's hope they do not interpret those
figures as a valid configuration for a threaded mpm aside from one
used to test a specific behaviour.

El vie, 12 mar 2021 a las 3:54, Eric Covener (<covener@gmail.com>) escribió:
>
> On Thu, Mar 11, 2021 at 9:29 PM motoda.hironori@fujitsu.com
> <motoda.hironori@fujitsu.com> wrote:
> >
> > In the following environment where multiple Listen directives are defined, the number of child processes may temporarily fall below MinSpareThreads after 6 requests are received at the same time and HTTP request processing is completed.
> > Is this a bug or a specification?
> >
> > OS : Red Hat Enterprise Linux Server
> > MPM: worker
> >
> > httpd.conf:
> > ----------------------------------------------------
> > Listen 80
> > Listen 8080
> >
> > ServerLimit 50
> > StartServers 5
> > MinSpareThreads 5
> > MaxSpareThreads 10
> > ThreadsPerChild 1
> > MaxRequestWorkers 50
> > MaxConnectionsPerChild 0
> > ----------------------------------------------------
>
> This is working as designed, the server checks only once per second to
> see if processes need to be started or killed based on the current
> idle threads.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


--
Daniel Ferradal
HTTPD Project
#httpd help at Freenode

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: The number of child processes is less than MinSpareThreads. [ In reply to ]
Hi Eric,
Thank you.

> This is working as designed, the server checks only once per second to
> see if processes need to be started or killed based on the current
> idle threads.

Is it okay for the number of child processes to fall below MinSpareThreads in this environment?
If possible, please tell me the reason.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: The number of child processes is less than MinSpareThreads. [ In reply to ]
On Mon, Mar 15, 2021 at 7:14 AM motoda.hironori@fujitsu.com
<motoda.hironori@fujitsu.com> wrote:
>
> > This is working as designed, the server checks only once per second to
> > see if processes need to be started or killed based on the current
> > idle threads.
>
> Is it okay for the number of child processes to fall below MinSpareThreads in this environment?
> If possible, please tell me the reason.

If there are 5 idle threads (e.g. StartServers=MinSpareThreads=5 with
ThreadsPerChild=1), when 6 connections/requests arrive and are being
handled then there is no idle thread anymore, so httpd has to make 5
new idle threads available (actually 5 children processes with
ThreadsPerChild=1) to honor MinSpareThreads=5.

Regards;
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: The number of child processes is less than MinSpareThreads. [ In reply to ]
> In the following environment where multiple Listen directives are defined, the number of child processes may temporarily
> fall below MinSpareThreads after 6 requests are received at the same time and HTTP request processing is completed.
> Is this a bug or a specification?

The process status is shown in the output of the following command.
# pstree -p `cat /opt/apache24/logs/httpd.pid`

In (3), all child processes have been terminated and new child processes have been created.
Isn't it a bug that all child processes are temporarily terminated?
If it's not a bug, please tell me why.


(1) It is in the state where httpd is started.
----------------------------------------------
Tue Mar 16 13:38:09 JST 2021
httpd(4035)-+-httpd(4036)-+-{httpd}(4046)
| `-{httpd}(4047)
|-httpd(4037)-+-{httpd}(4048)
| `-{httpd}(4049)
|-httpd(4038)-+-{httpd}(4050)
| `-{httpd}(4051)
|-httpd(4039)-+-{httpd}(4052)
| `-{httpd}(4053)
`-httpd(4040)-+-{httpd}(4054)
`-{httpd}(4055)
----------------------------------------------

(2) 6 requests are being processed.
----------------------------------------------
Tue Mar 16 13:38:26 JST 2021
httpd(4035)-+-httpd(4036)-+-{httpd}(4046)
| `-{httpd}(4047)
|-httpd(4037)-+-{httpd}(4048)
| `-{httpd}(4049)
|-httpd(4038)-+-{httpd}(4050)
| `-{httpd}(4051)
|-httpd(4039)-+-{httpd}(4052)
| `-{httpd}(4053)
|-httpd(4040)-+-{httpd}(4054)
| `-{httpd}(4055)
|-httpd(4101)-+-{httpd}(4103)
| `-{httpd}(4104)
|-httpd(4109)-+-{httpd}(4113)
| `-{httpd}(4114)
|-httpd(4110)-+-{httpd}(4115)
| `-{httpd}(4116)
|-httpd(4121)-+-{httpd}(4133)
| `-{httpd}(4134)
|-httpd(4122)-+-{httpd}(4135)
| `-{httpd}(4136)
|-httpd(4123)-+-{httpd}(4129)
| `-{httpd}(4130)
`-httpd(4124)-+-{httpd}(4131)
`-{httpd}(4132)
----------------------------------------------

(3) The following is the state transition after the request processing is completed.
----------------------------------------------
Tue Mar 16 13:38:38 JST 2021
httpd(4035)-+-httpd(4036)
|-httpd(4037)
|-httpd(4038)
|-httpd(4039)
|-httpd(4040)
|-httpd(4101)
|-httpd(4110)
|-httpd(4121)
|-httpd(4122)
|-httpd(4123)
`-httpd(4124)
----------------------------------------------
Tue Mar 16 13:38:39 JST 2021
httpd(4035)---httpd(4213)-+-{httpd}(4215)
`-{httpd}(4216)
----------------------------------------------
Tue Mar 16 13:38:40 JST 2021
httpd(4035)-+-httpd(4213)-+-{httpd}(4215)
| `-{httpd}(4216)
|-httpd(4221)-+-{httpd}(4225)
| `-{httpd}(4226)
`-httpd(4222)-+-{httpd}(4227)
`-{httpd}(4228)
----------------------------------------------
Tue Mar 16 13:38:41 JST 2021
httpd(4035)-+-httpd(4213)-+-{httpd}(4215)
| `-{httpd}(4216)
|-httpd(4221)-+-{httpd}(4225)
| `-{httpd}(4226)
|-httpd(4222)-+-{httpd}(4227)
| `-{httpd}(4228)
|-httpd(4233)-+-{httpd}(4245)
| `-{httpd}(4246)
|-httpd(4234)-+-{httpd}(4247)
| `-{httpd}(4248)
|-httpd(4235)-+-{httpd}(4241)
| `-{httpd}(4242)
`-httpd(4236)-+-{httpd}(4243)
`-{httpd}(4244)
----------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: The number of child processes is less than MinSpareThreads. [ In reply to ]
Hello,
We have issued the following bug report for this matter, so please reply to the bug report.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65196

> The process status is shown in the output of the following command.
> # pstree -p `cat /opt/apache24/logs/httpd.pid`
>
> In (3), all child processes have been terminated and new child processes have been created.
> Isn't it a bug that all child processes are temporarily terminated?
> If it's not a bug, please tell me why.
>
>
> (1) It is in the state where httpd is started.
> ----------------------------------------------
> Tue Mar 16 13:38:09 JST 2021
> httpd(4035)-+-httpd(4036)-+-{httpd}(4046)
> | `-{httpd}(4047)
> |-httpd(4037)-+-{httpd}(4048)
> | `-{httpd}(4049)
> |-httpd(4038)-+-{httpd}(4050)
> | `-{httpd}(4051)
> |-httpd(4039)-+-{httpd}(4052)
> | `-{httpd}(4053)
> `-httpd(4040)-+-{httpd}(4054)
> `-{httpd}(4055)
> ----------------------------------------------
>
> (2) 6 requests are being processed.
> ----------------------------------------------
> Tue Mar 16 13:38:26 JST 2021
> httpd(4035)-+-httpd(4036)-+-{httpd}(4046)
> | `-{httpd}(4047)
> |-httpd(4037)-+-{httpd}(4048)
> | `-{httpd}(4049)
> |-httpd(4038)-+-{httpd}(4050)
> | `-{httpd}(4051)
> |-httpd(4039)-+-{httpd}(4052)
> | `-{httpd}(4053)
> |-httpd(4040)-+-{httpd}(4054)
> | `-{httpd}(4055)
> |-httpd(4101)-+-{httpd}(4103)
> | `-{httpd}(4104)
> |-httpd(4109)-+-{httpd}(4113)
> | `-{httpd}(4114)
> |-httpd(4110)-+-{httpd}(4115)
> | `-{httpd}(4116)
> |-httpd(4121)-+-{httpd}(4133)
> | `-{httpd}(4134)
> |-httpd(4122)-+-{httpd}(4135)
> | `-{httpd}(4136)
> |-httpd(4123)-+-{httpd}(4129)
> | `-{httpd}(4130)
> `-httpd(4124)-+-{httpd}(4131)
> `-{httpd}(4132)
> ----------------------------------------------
>
> (3) The following is the state transition after the request processing is completed.
> ----------------------------------------------
> Tue Mar 16 13:38:38 JST 2021
> httpd(4035)-+-httpd(4036)
> |-httpd(4037)
> |-httpd(4038)
> |-httpd(4039)
> |-httpd(4040)
> |-httpd(4101)
> |-httpd(4110)
> |-httpd(4121)
> |-httpd(4122)
> |-httpd(4123)
> `-httpd(4124)
> ----------------------------------------------
> Tue Mar 16 13:38:39 JST 2021
> httpd(4035)---httpd(4213)-+-{httpd}(4215)
> `-{httpd}(4216)
> ----------------------------------------------
> Tue Mar 16 13:38:40 JST 2021
> httpd(4035)-+-httpd(4213)-+-{httpd}(4215)
> | `-{httpd}(4216)
> |-httpd(4221)-+-{httpd}(4225)
> | `-{httpd}(4226)
> `-httpd(4222)-+-{httpd}(4227)
> `-{httpd}(4228)
> ----------------------------------------------
> Tue Mar 16 13:38:41 JST 2021
> httpd(4035)-+-httpd(4213)-+-{httpd}(4215)
> | `-{httpd}(4216)
> |-httpd(4221)-+-{httpd}(4225)
> | `-{httpd}(4226)
> |-httpd(4222)-+-{httpd}(4227)
> | `-{httpd}(4228)
> |-httpd(4233)-+-{httpd}(4245)
> | `-{httpd}(4246)
> |-httpd(4234)-+-{httpd}(4247)
> | `-{httpd}(4248)
> |-httpd(4235)-+-{httpd}(4241)
> | `-{httpd}(4242)
> `-httpd(4236)-+-{httpd}(4243)
> `-{httpd}(4244)
> ----------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org