You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/01/10 00:00:33 UTC

svn commit: r1057048 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_status.c

Author: sf
Date: Sun Jan  9 23:00:33 2011
New Revision: 1057048

URL: http://svn.apache.org/viewvc?rev=1057048&view=rev
Log:
mod_status: Don't show slots which are disabled by MaxClients as open.

PR: 47022
Submitted by: Jordi Prats <jordi prats gmail com>, Stefan Fritsch

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/generators/mod_status.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1057048&r1=1057047&r2=1057048&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Jan  9 23:00:33 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.11
 
+  *) mod_status: Don't show slots which are disabled by MaxClients as open.
+     PR: 47022 [Jordi Prats <jordi prats gmail com>, Stefan Fritsch]
+
   *) mpm_prefork: Fix ap_mpm_query results for AP_MPMQ_MAX_DAEMONS and
      AP_MPMQ_MAX_THREADS.
 

Modified: httpd/httpd/trunk/modules/generators/mod_status.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=1057048&r1=1057047&r2=1057048&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_status.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_status.c Sun Jan  9 23:00:33 2011
@@ -86,7 +86,7 @@
 
 module AP_MODULE_DECLARE_DATA status_module;
 
-static int server_limit, thread_limit;
+static int server_limit, thread_limit, threads_per_child, max_servers;
 
 /* Implement 'ap_run_status_hook'. */
 APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap, STATUS, int, status_hook,
@@ -172,7 +172,11 @@ static const struct stat_opt status_opti
     {STAT_OPT_END, NULL, NULL}
 };
 
-static char status_flags[SERVER_NUM_STATUS];
+/* add another state for slots above the MaxClients setting */
+#define SERVER_DISABLED SERVER_NUM_STATUS
+#define MOD_STATUS_NUM_STATUS (SERVER_NUM_STATUS+1)
+
+static char status_flags[MOD_STATUS_NUM_STATUS];
 
 static int status_handler(request_rec *r)
 {
@@ -293,7 +297,12 @@ static int status_handler(request_rec *r
 
             ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
             res = ws_record->status;
-            stat_buffer[indx] = status_flags[res];
+
+            if ((i >= max_servers || j >= threads_per_child)
+                && (res == SERVER_DEAD))
+                stat_buffer[indx] = status_flags[SERVER_DISABLED];
+            else
+                stat_buffer[indx] = status_flags[res];
 
             if (!ps_record->quiescing
                 && ps_record->pid) {
@@ -483,7 +492,8 @@ static int status_handler(request_rec *r
         ap_rputs("\"<b><code>L</code></b>\" Logging, \n", r);
         ap_rputs("\"<b><code>G</code></b>\" Gracefully finishing,<br /> \n", r);
         ap_rputs("\"<b><code>I</code></b>\" Idle cleanup of worker, \n", r);
-        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process</p>\n", r);
+        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process,<br />\n", r);
+        ap_rputs("\"<b><code> </code></b>\" Slot disabled by MaxClients setting</p>\n", r);
         ap_rputs("<p />\n", r);
         if (!ap_extended_status) {
             int j;
@@ -809,8 +819,14 @@ static int status_init(apr_pool_t *p, ap
     status_flags[SERVER_CLOSING] = 'C';
     status_flags[SERVER_GRACEFUL] = 'G';
     status_flags[SERVER_IDLE_KILL] = 'I';
+    status_flags[SERVER_DISABLED] = ' ';
     ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
     ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit);
+    ap_mpm_query(AP_MPMQ_MAX_THREADS, &threads_per_child);
+    /* work around buggy MPMs */
+    if (threads_per_child == 0)
+        threads_per_child = 1;
+    ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_servers);
     return OK;
 }
 



Re: svn commit: r1057048 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_status.c

Posted by Rainer Jung <ra...@kippdata.de>.
On 26.04.2011 21:57, Jeff Trawick wrote:
> On Sun, Jan 9, 2011 at 6:00 PM,<sf...@apache.org>  wrote:
>> Author: sf
>> Date: Sun Jan  9 23:00:33 2011
>> New Revision: 1057048
>>
>> URL: http://svn.apache.org/viewvc?rev=1057048&view=rev
>> Log:
>> mod_status: Don't show slots which are disabled by MaxClients as open.
>
> They now get displayed as ' ' instead of '.'.
>
> No complaints here about not displaying unused slots as open, but the
> result can look a bit odd.
>
> ---------cut here-----------
> 1 requests currently being processed, 49 idle workers
>
> _________________________
>                                      ______W__________________
>
>
>
> Scoreboard Key:
> -----------cut here--------------
>
> On Windows, with huge default ThreadLimit relative to ThreadsPerChild,
> you're left with lots of unexpected whitespace.
>
> What about just surpressing the ' ' when printing out the worker map?
>
> After a graceful restart which shrinks MaxClients or ThreadsPerChild
> you might have the map gradually get smaller for a short time as
> workers in those "beyond" scoreboard entries exit, but generally it
> would look better.
>
> Comments?  (Do folks want the space used to reflect ThreadLimit * ServerLimit?)
>
>> Modified: httpd/httpd/trunk/modules/generators/mod_status.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=1057048&r1=1057047&r2=1057048&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/generators/mod_status.c (original)
>> +++ httpd/httpd/trunk/modules/generators/mod_status.c Sun Jan  9 23:00:33 2011
>
>> @@ -483,7 +492,8 @@ static int status_handler(request_rec *r
>>          ap_rputs("\"<b><code>L</code></b>\" Logging, \n", r);
>>          ap_rputs("\"<b><code>G</code></b>\" Gracefully finishing,<br />  \n", r);
>>          ap_rputs("\"<b><code>I</code></b>\" Idle cleanup of worker, \n", r);
>> -        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process</p>\n", r);
>> +        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process,<br />\n", r);
>> +        ap_rputs("\"<b><code>  </code></b>\" Slot disabled by MaxClients setting</p>\n", r);
>
>    (and/or by ThreadsPerChild)

I'd say the additional slots are more of an implementation detail 
(pre-allocated to allow increasing the actual available processes and 
threads by graceful restart) and do not provide relevant information for 
mod_status. So I am +1 for dropping, but can live with white space too.

Regards,

Rainer

Re: svn commit: r1057048 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_status.c

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Wednesday 27 April 2011, Jeff Trawick wrote:
> On Wed, Apr 27, 2011 at 12:27 PM, Jim Jagielski <ji...@jagunet.com> 
wrote:
> > How does this affect the XML output (sorry, can't test
> > here)? Personally, I'm sure there are scripts that take
> > the output from server-status and parse it, and specifically
> > look for '.'... this will break those.
> > 
> > (PS: Sorry if I'm missing out on the context of this
> >     change...)
> 
> You mean the short form ("/server-status?auto")?
> 
> Before this a.m.'s tweak, there would be blanks within the
> scoreboard map (single line of K_.CRWetc.).  Now the blanks are
> suppressed.

This is now what a script used to 2.2.x's output would expect.

Belatedly +1 for the fix. Thanks.

Re: svn commit: r1057048 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_status.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Apr 27, 2011 at 12:27 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> How does this affect the XML output (sorry, can't test
> here)? Personally, I'm sure there are scripts that take
> the output from server-status and parse it, and specifically
> look for '.'... this will break those.
>
> (PS: Sorry if I'm missing out on the context of this
>     change...)

You mean the short form ("/server-status?auto")?

Before this a.m.'s tweak, there would be blanks within the scoreboard
map (single line of K_.CRWetc.).  Now the blanks are suppressed.

>
> On Apr 26, 2011, at 3:57 PM, Jeff Trawick wrote:
>
>> On Sun, Jan 9, 2011 at 6:00 PM,  <sf...@apache.org> wrote:
>>> Author: sf
>>> Date: Sun Jan  9 23:00:33 2011
>>> New Revision: 1057048
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1057048&view=rev
>>> Log:
>>> mod_status: Don't show slots which are disabled by MaxClients as open.
>>
>> They now get displayed as ' ' instead of '.'.
>>
>> No complaints here about not displaying unused slots as open, but the
>> result can look a bit odd.
>>
>> ---------cut here-----------
>> 1 requests currently being processed, 49 idle workers
>>
>> _________________________
>>                                    ______W__________________
>>
>>
>>
>> Scoreboard Key:
>> -----------cut here--------------
>>
>> On Windows, with huge default ThreadLimit relative to ThreadsPerChild,
>> you're left with lots of unexpected whitespace.
>>
>> What about just surpressing the ' ' when printing out the worker map?
>>
>> After a graceful restart which shrinks MaxClients or ThreadsPerChild
>> you might have the map gradually get smaller for a short time as
>> workers in those "beyond" scoreboard entries exit, but generally it
>> would look better.
>>
>> Comments?  (Do folks want the space used to reflect ThreadLimit * ServerLimit?)
>>
>>> Modified: httpd/httpd/trunk/modules/generators/mod_status.c
>>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=1057048&r1=1057047&r2=1057048&view=diff
>>> ==============================================================================
>>> --- httpd/httpd/trunk/modules/generators/mod_status.c (original)
>>> +++ httpd/httpd/trunk/modules/generators/mod_status.c Sun Jan  9 23:00:33 2011
>>
>>> @@ -483,7 +492,8 @@ static int status_handler(request_rec *r
>>>         ap_rputs("\"<b><code>L</code></b>\" Logging, \n", r);
>>>         ap_rputs("\"<b><code>G</code></b>\" Gracefully finishing,<br /> \n", r);
>>>         ap_rputs("\"<b><code>I</code></b>\" Idle cleanup of worker, \n", r);
>>> -        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process</p>\n", r);
>>> +        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process,<br />\n", r);
>>> +        ap_rputs("\"<b><code> </code></b>\" Slot disabled by MaxClients setting</p>\n", r);
>>
>>  (and/or by ThreadsPerChild)
>>
>
>



-- 
Born in Roswell... married an alien...

Re: svn commit: r1057048 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_status.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
How does this affect the XML output (sorry, can't test
here)? Personally, I'm sure there are scripts that take
the output from server-status and parse it, and specifically
look for '.'... this will break those.

(PS: Sorry if I'm missing out on the context of this
     change...)

On Apr 26, 2011, at 3:57 PM, Jeff Trawick wrote:

> On Sun, Jan 9, 2011 at 6:00 PM,  <sf...@apache.org> wrote:
>> Author: sf
>> Date: Sun Jan  9 23:00:33 2011
>> New Revision: 1057048
>> 
>> URL: http://svn.apache.org/viewvc?rev=1057048&view=rev
>> Log:
>> mod_status: Don't show slots which are disabled by MaxClients as open.
> 
> They now get displayed as ' ' instead of '.'.
> 
> No complaints here about not displaying unused slots as open, but the
> result can look a bit odd.
> 
> ---------cut here-----------
> 1 requests currently being processed, 49 idle workers
> 
> _________________________
>                                    ______W__________________
> 
> 
> 
> Scoreboard Key:
> -----------cut here--------------
> 
> On Windows, with huge default ThreadLimit relative to ThreadsPerChild,
> you're left with lots of unexpected whitespace.
> 
> What about just surpressing the ' ' when printing out the worker map?
> 
> After a graceful restart which shrinks MaxClients or ThreadsPerChild
> you might have the map gradually get smaller for a short time as
> workers in those "beyond" scoreboard entries exit, but generally it
> would look better.
> 
> Comments?  (Do folks want the space used to reflect ThreadLimit * ServerLimit?)
> 
>> Modified: httpd/httpd/trunk/modules/generators/mod_status.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=1057048&r1=1057047&r2=1057048&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/generators/mod_status.c (original)
>> +++ httpd/httpd/trunk/modules/generators/mod_status.c Sun Jan  9 23:00:33 2011
> 
>> @@ -483,7 +492,8 @@ static int status_handler(request_rec *r
>>         ap_rputs("\"<b><code>L</code></b>\" Logging, \n", r);
>>         ap_rputs("\"<b><code>G</code></b>\" Gracefully finishing,<br /> \n", r);
>>         ap_rputs("\"<b><code>I</code></b>\" Idle cleanup of worker, \n", r);
>> -        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process</p>\n", r);
>> +        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process,<br />\n", r);
>> +        ap_rputs("\"<b><code> </code></b>\" Slot disabled by MaxClients setting</p>\n", r);
> 
>  (and/or by ThreadsPerChild)
> 


Re: svn commit: r1057048 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_status.c

Posted by Jeff Trawick <tr...@gmail.com>.
On Sun, Jan 9, 2011 at 6:00 PM,  <sf...@apache.org> wrote:
> Author: sf
> Date: Sun Jan  9 23:00:33 2011
> New Revision: 1057048
>
> URL: http://svn.apache.org/viewvc?rev=1057048&view=rev
> Log:
> mod_status: Don't show slots which are disabled by MaxClients as open.

They now get displayed as ' ' instead of '.'.

No complaints here about not displaying unused slots as open, but the
result can look a bit odd.

---------cut here-----------
1 requests currently being processed, 49 idle workers

_________________________
                                    ______W__________________



Scoreboard Key:
-----------cut here--------------

On Windows, with huge default ThreadLimit relative to ThreadsPerChild,
you're left with lots of unexpected whitespace.

What about just surpressing the ' ' when printing out the worker map?

After a graceful restart which shrinks MaxClients or ThreadsPerChild
you might have the map gradually get smaller for a short time as
workers in those "beyond" scoreboard entries exit, but generally it
would look better.

Comments?  (Do folks want the space used to reflect ThreadLimit * ServerLimit?)

> Modified: httpd/httpd/trunk/modules/generators/mod_status.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=1057048&r1=1057047&r2=1057048&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/generators/mod_status.c (original)
> +++ httpd/httpd/trunk/modules/generators/mod_status.c Sun Jan  9 23:00:33 2011

> @@ -483,7 +492,8 @@ static int status_handler(request_rec *r
>         ap_rputs("\"<b><code>L</code></b>\" Logging, \n", r);
>         ap_rputs("\"<b><code>G</code></b>\" Gracefully finishing,<br /> \n", r);
>         ap_rputs("\"<b><code>I</code></b>\" Idle cleanup of worker, \n", r);
> -        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process</p>\n", r);
> +        ap_rputs("\"<b><code>.</code></b>\" Open slot with no current process,<br />\n", r);
> +        ap_rputs("\"<b><code> </code></b>\" Slot disabled by MaxClients setting</p>\n", r);

  (and/or by ThreadsPerChild)