Hi guys,
today I've upgraded one of my servers from 1.3 to 2.2 and discovered a problem 
with
mod_status in newer versions. It is not a big problem, but it certainly is an 
inconsistency
between default and "notable mode" when extended status is set enabled.

I'm running mod_proxy as front end for video stream servers and using 
mod_status output
to check which connections are active.

Output from Apache 1.3.37 mod_status looks like this:
 /default mode/
   Srv  PID  Acc M CPU  SS Req Conn Child Slot        Client   VHost            
Request
   37-0 5013 0/237/237   W  0.53 1 0 0.0 28.34 28.34  1.2.3.4  host.example.org 
GET /proxied/stream.avi HTTP/1.1
 /notables mode/
   Server 0-0 (4965): 0|0|0 [Write] u0 s0 cu0 cs0 1 0 (0 B|0 B|0 B) 1.2.3.4 
{GET /proxied/stream.avi HTTP/1.1} [host.example.org]

Output from Apache 2.0.59 and 2.2.3 mod_status is looks like this:
 /default mode/
   Srv PID   Acc M CPU  SS  Req  Conn Child Slot Client  VHost  Request
   1-3 28181 0/0/0       R  0.00 78    0 0.0 0.00 0.00   ?      ?         
..reading..
 /notables mode/
   Server 1-3 (28181): 0|0|0 [Read] u0 s0 cu0 cs0 44 0 (0 B|0 B|0 B) 1.2.3.4 
{GET /proxied/stream.avi HTTP/1.1} [host.example.org]

Ignoring the fact that 1.3 shows connections in Write status and 2.x in Read 
status,
the problem is that connections in Read status are missing client, vhost and 
request
fields when shown as table.

Looking at the source of mod_status I see "...status == SERVER_BUSY_READ" check 
but
IMHO this check is bogus and can be removed, thus making "notable mode" and 
default
status output consistent.

Attached are patches for 1.3, 2.0.59 and 2.2.3 that remove the check 
responsible for
"...reading..." message.

If they're OK, please apply.

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
To apply go to apache-1.3.27/ directory and run patch -p1 < 
../mod_status_1.3.27.diff

--- apache_1.3.37/src/modules/standard/mod_status.c-org 2006-10-08 
00:14:38.000000000 +0300
+++ apache_1.3.37/src/modules/standard/mod_status.c     2006-10-08 
00:15:58.000000000 +0300
@@ -648,16 +648,12 @@
                        ap_rprintf(r, "<td>%-1.1f<td>%-2.2f<td>%-2.2f\n",
                           (float) conn_bytes / KBYTE, (float) my_bytes / MBYTE,
                            (float) bytes / MBYTE);
-                       if (score_record.status == SERVER_BUSY_READ)
-                           ap_rprintf(r,
-                            "<td>?<td nowrap>?<td nowrap>..reading.. 
</tr>\n\n");
-                       else
-                           ap_rprintf(r,
-                            "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
-                            ap_escape_html(r->pool, score_record.client),
-                            vhost ? ap_escape_html(r->pool, 
-                               vhost->server_hostname) : "(unavailable)",
-                            ap_escape_html(r->pool, score_record.request));
+                   ap_rprintf(r,
+                    "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
+                    ap_escape_html(r->pool, score_record.client),
+                    vhost ? ap_escape_html(r->pool, 
+                       vhost->server_hostname) : "(unavailable)",
+                    ap_escape_html(r->pool, score_record.request));
                    }           /* no_table_report */
                }                       /* !short_report */
            }                   /* if (<active child>) */
To apply go to http-2.0.59/ directory and run patch -p1 < 
../mod_status_2.0.59.diff

--- httpd-2.0.59/modules/generators/mod_status.c-org    2006-10-08 
00:06:00.000000000 +0300
+++ httpd-2.0.59/modules/generators/mod_status.c        2006-10-08 
00:08:02.000000000 +0300
@@ -742,18 +742,14 @@
                                (float)conn_bytes / KBYTE, (float) my_bytes / 
MBYTE,
                                (float)bytes / MBYTE);
                     
-                    if (ws_record->status == SERVER_BUSY_READ)
-                        ap_rprintf(r,
-                                   "</td><td>?</td><td nowrap>?</td><td 
nowrap>..reading.. </td></tr>\n\n");
-                    else
-                        ap_rprintf(r,
-                                   "</td><td>%s</td><td nowrap>%s</td><td 
nowrap>%s</td></tr>\n\n",
-                                   ap_escape_html(r->pool,
-                                                  ws_record->client),
-                                   ap_escape_html(r->pool,
-                                                  ws_record->vhost),
-                                   ap_escape_html(r->pool,
-                                                  ws_record->request));
+                    ap_rprintf(r,
+                               "</td><td>%s</td><td nowrap>%s</td><td 
nowrap>%s</td></tr>\n\n",
+                               ap_escape_html(r->pool,
+                                              ws_record->client),
+                               ap_escape_html(r->pool,
+                                              ws_record->vhost),
+                               ap_escape_html(r->pool,
+                                              ws_record->request));
                 } /* no_table_report */
             } /* for (j...) */
         } /* for (i...) */
To apply go to http-2.2.3/ directory and run patch -p1 < 
../mod_status_2.2.3.diff

--- httpd-2.2.3/modules/generators/mod_status.c-org     2006-10-08 
00:10:57.000000000 +0300
+++ httpd-2.2.3/modules/generators/mod_status.c 2006-10-08 00:11:20.000000000 
+0300
@@ -752,18 +752,14 @@
                                (float)conn_bytes / KBYTE, (float) my_bytes / 
MBYTE,
                                (float)bytes / MBYTE);
 
-                    if (ws_record->status == SERVER_BUSY_READ)
-                        ap_rprintf(r,
-                                   "</td><td>?</td><td nowrap>?</td><td 
nowrap>..reading.. </td></tr>\n\n");
-                    else
-                        ap_rprintf(r,
-                                   "</td><td>%s</td><td nowrap>%s</td><td 
nowrap>%s</td></tr>\n\n",
-                                   ap_escape_html(r->pool,
-                                                  ws_record->client),
-                                   ap_escape_html(r->pool,
-                                                  ws_record->vhost),
-                                   ap_escape_html(r->pool,
-                                                  ws_record->request));
+                    ap_rprintf(r,
+                               "</td><td>%s</td><td nowrap>%s</td><td 
nowrap>%s</td></tr>\n\n",
+                               ap_escape_html(r->pool,
+                                              ws_record->client),
+                               ap_escape_html(r->pool,
+                                              ws_record->vhost),
+                               ap_escape_html(r->pool,
+                                              ws_record->request));
                 } /* no_table_report */
             } /* for (j...) */
         } /* for (i...) */

Reply via email to