tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r440649 - in /tomcat/connectors/trunk/jk/native/common: jk_ajp13.h jk_ajp_common.c
Date Wed, 06 Sep 2006 07:54:13 GMT
Author: mturk
Date: Wed Sep  6 00:54:12 2006
New Revision: 440649

URL: http://svn.apache.org/viewvc?view=rev&rev=440649
Log:
Differentiate client errors by splitting the
JK_CLIENT_ERROR to read and write errors.
We don't wish to log the client broken requests
as 400 if the client closes the connection before
receiving all the data.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp13.h
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp13.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp13.h?view=diff&rev=440649&r1=440648&r2=440649
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp13.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp13.h Wed Sep  6 00:54:12 2006
@@ -41,6 +41,9 @@
 #define JK_FATAL_ERROR              (-3)
 #define JK_CLIENT_ERROR             (-4)
 #define JK_SERVER_ERROR             (-5)
+#define JK_CLIENT_RD_ERROR          (-6)
+#define JK_CLIENT_WR_ERROR          (-7)
+
 #define AJP13_MAX_SEND_BODY_SZ      (DEF_BUFFER_SZ - 6)
 #define AJP13_DEF_TIMEOUT           (0) /* Idle timout for pooled connections */
 

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?view=diff&rev=440649&r1=440648&r2=440649
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Wed Sep  6 00:54:12 2006
@@ -1067,7 +1067,7 @@
         if (!s->read(s, buf + rdlen, len - rdlen, &this_time)) {
             /* Remote Client read failed. */
             JK_TRACE_EXIT(l);
-            return JK_CLIENT_ERROR;
+            return JK_CLIENT_RD_ERROR;
         }
 
         if (0 == this_time) {
@@ -1111,7 +1111,7 @@
                "Connection aborted or network problems",
                ae->worker->name);
         JK_TRACE_EXIT(l);
-        return JK_CLIENT_ERROR;
+        return JK_CLIENT_RD_ERROR;
     }
 
     if (!r->is_chunked) {
@@ -1125,7 +1125,7 @@
             jk_log(l, JK_LOG_INFO,
                    "Failed appending message length");
             JK_TRACE_EXIT(l);
-            return JK_CLIENT_ERROR;
+            return JK_CLIENT_RD_ERROR;
         }
     }
 
@@ -1333,7 +1333,7 @@
                 /* the browser stop sending data, no need to recover */
                 op->recoverable = JK_FALSE;
                 JK_TRACE_EXIT(l);
-                return JK_CLIENT_ERROR;
+                return JK_CLIENT_RD_ERROR;
             }
 
             /* If a RECOVERY buffer is available in LB mode, fill it */
@@ -1410,7 +1410,7 @@
                 jk_log(l, JK_LOG_INFO,
                        "Writing to client aborted or client network problems");
                 JK_TRACE_EXIT(l);
-                return JK_CLIENT_ERROR;
+                return JK_CLIENT_WR_ERROR;
             }
             if (r->flush && r->flush_packets)
                 r->flush(r);
@@ -1442,7 +1442,7 @@
                    "Reding from client aborted or client network problems");
 
             JK_TRACE_EXIT(l);
-            return JK_CLIENT_ERROR;
+            return JK_CLIENT_RD_ERROR;
         }
         break;
 
@@ -1636,16 +1636,21 @@
             JK_TRACE_EXIT(l);
             return JK_FALSE;
         }
-        else if (JK_CLIENT_ERROR == rc) {
+        else if (JK_CLIENT_RD_ERROR == rc) {
             /*
-             * Client has stop talking to us, so get out.
+             * Client has stop sending to us, so get out.
              * We assume this isn't our fault, so just a normal exit.
-             * In most (all?)  cases, the ajp13_endpoint::reuse will still be
-             * false here, so this will be functionally the same as an
-             * un-recoverable error.  We just won't log it as such.
              */
             JK_TRACE_EXIT(l);
-            return JK_CLIENT_ERROR;
+            return JK_CLIENT_RD_ERROR;
+        }
+        else if (JK_CLIENT_RD_ERROR == rc) {
+            /*
+             * Client has stop receiving to us, so get out.
+             * We assume this isn't our fault, so just a normal exit.
+             */
+            JK_TRACE_EXIT(l);
+            return JK_CLIENT_WR_ERROR;
         }
         else if (JK_SERVER_ERROR == rc) {
             /*
@@ -1766,7 +1771,7 @@
                 return JK_TRUE;
             }
 
-            if (err == JK_CLIENT_ERROR) {
+            if (err == JK_CLIENT_RD_ERROR) {
                 *is_error = JK_HTTP_BAD_REQUEST;
                 if (p->worker->recovery_opts & RECOVER_ABORT_IF_CLIENTERROR) {
                     /* Mark the endpoint for shutdown */
@@ -1774,7 +1779,22 @@
                 }
                 jk_log(l, JK_LOG_INFO,
                        "(%s) request failed, "
-                       "because of client error "
+                       "because of client read error "
+                       "without recovery in send loop attempt=%d",
+                       p->worker->name, i);
+                JK_TRACE_EXIT(l);
+                return JK_CLIENT_ERROR;
+            }
+            else if (err == JK_CLIENT_WR_ERROR) {
+                /* XXX: Is this correct to log this as 200? */
+                *is_error = JK_HTTP_OK;
+                if (p->worker->recovery_opts & RECOVER_ABORT_IF_CLIENTERROR) {
+                    /* Mark the endpoint for shutdown */
+                    p->reuse = JK_FALSE;
+                }
+                jk_log(l, JK_LOG_INFO,
+                       "(%s) request failed, "
+                       "because of client write error "
                        "without recovery in send loop attempt=%d",
                        p->worker->name, i);
                 JK_TRACE_EXIT(l);
@@ -1784,7 +1804,7 @@
                 *is_error = JK_HTTP_SERVER_ERROR;
                 jk_log(l, JK_LOG_INFO,
                        "(%s) request failed, "
-                       "because of client error "
+                       "because of server error "
                        "without recovery in send loop attempt=%d",
                        p->worker->name, i);
                 JK_TRACE_EXIT(l);
@@ -1815,7 +1835,7 @@
                 }
             }
         }
-        if (err == JK_CLIENT_ERROR) {
+        if (err == JK_CLIENT_RD_ERROR) {
             *is_error = JK_HTTP_BAD_REQUEST;
             if (p->worker->recovery_opts & RECOVER_ABORT_IF_CLIENTERROR) {
                 /* Mark the endpoint for shutdown */
@@ -1823,7 +1843,21 @@
             }
             jk_log(l, JK_LOG_INFO,
                    "(%s) sending request to tomcat failed, "
-                   "because of client error "
+                   "because of client read error "
+                   "without recovery in send loop attempt=%d",
+                   p->worker->name, i);
+            JK_TRACE_EXIT(l);
+            return JK_CLIENT_ERROR;
+        }
+        else if (err == JK_CLIENT_WR_ERROR) {
+            *is_error = JK_HTTP_OK;
+            if (p->worker->recovery_opts & RECOVER_ABORT_IF_CLIENTERROR) {
+                /* Mark the endpoint for shutdown */
+                p->reuse = JK_FALSE;
+            }
+            jk_log(l, JK_LOG_INFO,
+                   "(%s) sending request to tomcat failed, "
+                   "because of client write error "
                    "without recovery in send loop attempt=%d",
                    p->worker->name, i);
             JK_TRACE_EXIT(l);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message