]> granicus.if.org Git - apache/commitdiff
fix some logging glitches in the WinNT MPM:
authorJeff Trawick <trawick@apache.org>
Sat, 9 Apr 2011 15:03:36 +0000 (15:03 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 9 Apr 2011 15:03:36 +0000 (15:03 +0000)
the MPM's equivalent of "reached MaxClients" is now ERR instead of
WARNING

the message when the MPM child exits due to excessive errors is
raised from ERR to CRIT

the caller of mpm_get_completion_context() could log random error
values (GetLastError() or rv), so solve as follows:

. mpm_get_completion_context() always logs its errors
. caller only logs when it is taking a rare action on such errors, and
  doesn't pretend to know the error code of the last such error

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1090605 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/child.c

index 94368a5435882750ceba510070b454ef3fdbe44d..2eee477b929af1cc6b344e57923afbea299c593e 100644 (file)
@@ -165,7 +165,7 @@ static winnt_conn_ctx_t *mpm_get_completion_context(void)
                 /* All workers are busy, need to wait for one */
                 static int reported = 0;
                 if (!reported) {
-                    ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf,
+                    ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf,
                                  "Server ran out of threads to serve "
                                  "requests. Consider raising the "
                                  "ThreadsPerChild setting");
@@ -180,8 +180,22 @@ static winnt_conn_ctx_t *mpm_get_completion_context(void)
                 rv = WaitForSingleObject(qwait_event, 1000);
                 if (rv == WAIT_OBJECT_0)
                     continue;
-                else /* Hopefully, WAIT_TIMEOUT */
+                else {
+                    if (rv == WAIT_TIMEOUT) {
+                        /* somewhat-normal condition where threads are busy */
+                        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf,
+                                     "mpm_get_completion_context: Failed to get a "
+                                     "free context within 1 second");
+                    }
+                    else {
+                        /* should be the unexpected, generic WAIT_FAILED */
+                        ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_os_error(),
+                                     ap_server_conf,
+                                     "mpm_get_completion_context: "
+                                     "WaitForSingleObject failed to get free context");
+                    }
                     return NULL;
+                }
             } else {
                 /* Allocate another context.
                  * Note: Multiple failures in the next two steps will cause
@@ -349,17 +363,11 @@ reinit: /* target of data or connect upon too many AcceptEx failures */
                 /* Hopefully a temporary condition in the provider? */
                 ++err_count;
                 if (err_count > MAX_ACCEPTEX_ERR_COUNT) {
-                    ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,
+                    ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf,
                                  "winnt_accept: Too many failures grabbing a "
                                  "connection ctx.  Aborting.");
                     break;
                 }
-
-                /* Temporary resource constraint? */
-                ap_log_error(APLOG_MARK, APLOG_DEBUG, apr_get_netos_error(), 
-                             ap_server_conf,
-                             "winnt_accept: Failed to grab a connection ctx."
-                             "  Temporary resource constraint? Retrying.");
                 Sleep(100);
                 continue;
             }