Author: rjung
Date: Sun Nov 19 05:26:00 2006
New Revision: 476817

URL: http://svn.apache.org/viewvc?view=rev&rev=476817
Log:
- Check if socket is still connected, even if socket_timeout=0.
- Change log message levels according to their real severity.
- Add a hint for the "all ... dead" message.
- Adding forgotten socket closes in certain error conditions
- Open a new connection when trying to send a new request,
  even if all preexisting connections are unusable (backend
  timeout).

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

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=476817&r1=476816&r2=476817
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Nov 19 
05:26:00 2006
@@ -1166,15 +1166,13 @@
     while (IS_VALID_SOCKET(ae->sd)) {
         int rc = 0;
         err = 0;
-        if (ae->worker->socket_timeout > 0) {
-            if (!jk_is_socket_connected(ae->sd)) {
-                jk_log(l, JK_LOG_INFO,
-                       "(%s) socket %d is not connected any more (errno=%d)",
-                       ae->worker->name, ae->sd, errno);
-                jk_close_socket(ae->sd);
-                ae->sd = JK_INVALID_SOCKET;
-                err++;
-            }
+        if (!jk_is_socket_connected(ae->sd)) {
+            jk_log(l, JK_LOG_DEBUG,
+                   "(%s) socket %d is not connected any more (errno=%d)",
+                   ae->worker->name, ae->sd, errno);
+            jk_close_socket(ae->sd);
+            ae->sd = JK_INVALID_SOCKET;
+            err=1;
         }
         if (ae->worker->prepost_timeout > 0 && !err) {
             /* handle cping/cpong if prepost_timeout is set
@@ -1183,7 +1181,7 @@
              */
             if (ajp_handle_cping_cpong(ae, ae->worker->prepost_timeout, l) ==
                 JK_FALSE)
-                err++;
+                err=1;
         }
 
         /* If we got an error or can't send data, then try to get a pooled
@@ -1192,16 +1190,18 @@
         if (err ||
             ((rc = ajp_connection_tcp_send_message(ae, op->request, l)) != 
JK_TRUE)) {
             if (rc != JK_FATAL_ERROR) {
-                jk_log(l, JK_LOG_INFO,
+                jk_log(l, JK_LOG_DEBUG,
                        "(%s) error sending request. Will try another pooled 
connection",
                        ae->worker->name);
                 ajp_next_connection(ae, l);
             }
             else {
                 op->recoverable = JK_FALSE;
-                jk_log(l, JK_LOG_INFO,
+                jk_log(l, JK_LOG_ERROR,
                        "(%s) error sending request. Unrecoverable operation",
                        ae->worker->name);
+                jk_close_socket(ae->sd);
+                ae->sd = JK_INVALID_SOCKET;
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
             }
@@ -1219,8 +1219,8 @@
             jk_log(l, JK_LOG_INFO,
                    "(%s) all endpoints are disconnected or dead",
                    ae->worker->name);
-            JK_TRACE_EXIT(l);
-            return JK_FALSE;
+            jk_log(l, JK_LOG_INFO,
+                   "Increase the backend idle connection timeout or the 
connection_pool_minsize");
         }
         /* Connect to the backend.
          * This can be either uninitalized connection or a reconnect.
@@ -1632,6 +1632,8 @@
                 jk_log(l, JK_LOG_ERROR,
                        "(%s) Tomcat is down or network problems",
                         p->worker->name);
+                jk_close_socket(p->sd);
+                p->sd = JK_INVALID_SOCKET;
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to