You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2007/01/28 15:55:08 UTC

svn commit: r500805 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp_common.c native/common/jk_connect.c native/common/jk_lb_worker.c native/common/jk_uri_worker_map.c native/common/jk_worker.c xdocs/miscellaneous/changelog.xml

Author: rjung
Date: Sun Jan 28 06:55:07 2007
New Revision: 500805

URL: http://svn.apache.org/viewvc?view=rev&rev=500805
Log:
- BZ41332: Add some more errno logging and unify the format.
- Add a forgotten item to changelog:
  Use correct windows line endings for log file on WIN32 platform.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
    tomcat/connectors/trunk/jk/native/common/jk_connect.c
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
    tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
    tomcat/connectors/trunk/jk/native/common/jk_worker.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

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=500805&r1=500804&r2=500805
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Jan 28 06:55:07 2007
@@ -760,6 +760,7 @@
         rc = select((int)ae->sd + 1, &rset, NULL, NULL, &tv);
     } while (rc < 0 && errno == EINTR);
 
+    ae->last_errno = 0;
     if (rc == 0) {
         /* Timeout. Set the errno to timeout */
 #if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
@@ -767,11 +768,13 @@
 #else
         errno = ETIMEDOUT;
 #endif
+        ae->last_errno = errno;
         return JK_FALSE;
     }
     else if (rc < 0) {
+        ae->last_errno = errno;
         jk_log(l, JK_LOG_WARNING,
-               "error during select err=%d", errno);
+               "error during select (errno=%d)", ae->last_errno);
         return JK_FALSE;
     }
     else
@@ -871,8 +874,8 @@
     ae->last_errno = errno;
 
     jk_log(l, JK_LOG_INFO,
-           "Failed opening socket to (%s) with (errno=%d)",
-           jk_dump_hinfo(&ae->worker->worker_inet_addr, buf), errno);
+           "Failed opening socket to (%s) (errno=%d)",
+           jk_dump_hinfo(&ae->worker->worker_inet_addr, buf), ae->last_errno);
     JK_TRACE_EXIT(l);
     return JK_FALSE;
 }
@@ -913,7 +916,7 @@
     }
     ae->last_errno = errno;
     jk_log(l, JK_LOG_ERROR,
-           "sendfull returned %d with errno=%d ", rc, ae->last_errno);
+           "sendfull returned %d (errno=%d)", rc, ae->last_errno);
 
     JK_TRACE_EXIT(l);
     return JK_FALSE;
@@ -947,9 +950,9 @@
         else {
             jk_log(l, JK_LOG_ERROR,
                    "(%s) can't receive the response message from tomcat, "
-                   "network problems or tomcat is down (%s), err=%d",
-                   ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr,
-                                                   buf), rc);
+                   "network problems or tomcat (%s) is down (errno=%d)",
+                   ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf),
+                   ae->last_errno);
              JK_TRACE_EXIT(l);
         }
         return JK_FALSE;
@@ -1013,13 +1016,24 @@
     rc = jk_tcp_socket_recvfull(ae->sd, msg->buf, msglen);
     if (rc < 0) {
         ae->last_errno = errno;
-        jk_log(l, JK_LOG_ERROR,
-               "(%s) can't receive the response message from tomcat, "
-               "network problems or tomcat (%s) is down %d",
-               ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf),
-                                               rc);
-        JK_TRACE_EXIT(l);
-        return JK_FALSE;
+        if (rc == JK_SOCKET_EOF) {
+            jk_log(l, JK_LOG_ERROR,
+                   "(%s) can't receive the response message from tomcat, "
+                   "tomcat (%s) has forced a connection close for socket %d",
+                   ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf),
+                   ae->sd);
+            JK_TRACE_EXIT(l);
+            return JK_FALSE;
+        }
+        else {
+            jk_log(l, JK_LOG_ERROR,
+                   "(%s) can't receive the response message from tomcat, "
+                   "network problems or tomcat (%s) is down (errno=%d)",
+                   ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf),
+                   ae->last_errno);
+            JK_TRACE_EXIT(l);
+            return JK_FALSE;
+        }
     }
     ae->last_errno = 0;
     ae->endpoint.rd += rc;
@@ -1544,8 +1558,8 @@
                 JK_FALSE) {
                 jk_log(l, JK_LOG_ERROR,
                        "(%s) Timeout with waiting reply from tomcat. "
-                       "Tomcat is down, stopped or network problems.",
-                       p->worker->name);
+                       "Tomcat is down, stopped or network problems (errno=%d)",
+                       p->worker->name, p->last_errno);
                 if (headeratclient == JK_FALSE) {
                     if (p->worker->recovery_opts & RECOVER_ABORT_IF_TCGETREQUEST)
                         op->recoverable = JK_FALSE;
@@ -2012,7 +2026,7 @@
             p->ep_cache[i] = (ajp_endpoint_t *)calloc(1, sizeof(ajp_endpoint_t));
             if (!p->ep_cache[i]) {
                 jk_log(l, JK_LOG_ERROR,
-                        "allocating endpoint slot %d errno=%d",
+                        "allocating endpoint slot %d (errno=%d)",
                         i, errno);
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
@@ -2148,7 +2162,7 @@
         JK_INIT_CS(&(p->cs), rc);
         if (!rc) {
             jk_log(l, JK_LOG_ERROR,
-                   "creating thread lock errno=%d",
+                   "creating thread lock (errno=%d)",
                    errno);
             JK_TRACE_EXIT(l);
             return JK_FALSE;
@@ -2272,7 +2286,7 @@
         }
 
         jk_log(l, JK_LOG_ERROR,
-               "locking thread with errno=%d", errno);
+               "locking thread (errno=%d)", errno);
         JK_TRACE_EXIT(l);
         return JK_FALSE;
     }
@@ -2327,7 +2341,7 @@
         }
         else {
            jk_log(l, JK_LOG_ERROR,
-                  "locking thread with errno=%d",
+                  "locking thread (errno=%d)",
                   errno);
             JK_TRACE_EXIT(l);
             return JK_FALSE;
@@ -2403,7 +2417,7 @@
         }
         else {
            jk_log(l, JK_LOG_ERROR,
-                  "locking thread with errno=%d",
+                  "locking thread (errno=%d)",
                   errno);
             JK_TRACE_EXIT(l);
             return JK_FALSE;

Modified: tomcat/connectors/trunk/jk/native/common/jk_connect.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_connect.c?view=diff&rev=500805&r1=500804&r2=500805
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_connect.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_connect.c Sun Jan 28 06:55:07 2007
@@ -317,7 +317,7 @@
     if (!IS_VALID_SOCKET(sock)) {
         JK_GET_SOCKET_ERRNO();
         jk_log(l, JK_LOG_ERROR,
-               "socket() failed with errno=%d", errno);
+               "socket() failed (errno=%d)", errno);
         JK_TRACE_EXIT(l);
         return JK_INVALID_SOCKET;
 ;
@@ -326,7 +326,7 @@
     if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (SET_TYPE)&set,
                    sizeof(set))) {
         jk_log(l, JK_LOG_ERROR,
-                "failed setting TCP_NODELAY with errno=%d", errno);
+                "failed setting TCP_NODELAY (errno=%d)", errno);
         jk_close_socket(sock);
         JK_TRACE_EXIT(l);
         return JK_INVALID_SOCKET;
@@ -339,7 +339,7 @@
         if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (SET_TYPE)&set,
                        sizeof(set))) {
             jk_log(l, JK_LOG_ERROR,
-                   "failed setting SO_KEEPALIVE with errno=%d", errno);
+                   "failed setting SO_KEEPALIVE (errno=%d)", errno);
             jk_close_socket(sock);
             JK_TRACE_EXIT(l);
             return JK_INVALID_SOCKET;
@@ -356,7 +356,7 @@
                         sizeof(set))) {
             JK_GET_SOCKET_ERRNO();
             jk_log(l, JK_LOG_ERROR,
-                    "failed setting SO_SNDBUF with errno=%d", errno);
+                    "failed setting SO_SNDBUF (errno=%d)", errno);
             jk_close_socket(sock);
             JK_TRACE_EXIT(l);
             return JK_INVALID_SOCKET;
@@ -367,7 +367,7 @@
                                 sizeof(set))) {
             JK_GET_SOCKET_ERRNO();
             jk_log(l, JK_LOG_ERROR,
-                    "failed setting SO_RCVBUF with errno=%d", errno);
+                    "failed setting SO_RCVBUF (errno=%d)", errno);
             jk_close_socket(sock);
             JK_TRACE_EXIT(l);
             return JK_INVALID_SOCKET;
@@ -409,7 +409,7 @@
                    sizeof(int))) {
         JK_GET_SOCKET_ERRNO();
         jk_log(l, JK_LOG_ERROR,
-                "failed setting SO_NOSIGPIPE with errno=%d", errno);
+                "failed setting SO_NOSIGPIPE (errno=%d)", errno);
         jk_close_socket(sock);
         JK_TRACE_EXIT(l);
         return JK_INVALID_SOCKET;
@@ -422,7 +422,7 @@
                    sizeof(li))) {
         JK_GET_SOCKET_ERRNO();
         jk_log(l, JK_LOG_ERROR,
-                "failed setting SO_LINGER with errno=%d", errno);
+                "failed setting SO_LINGER (errno=%d)", errno);
         jk_close_socket(sock);
         JK_TRACE_EXIT(l);
         return JK_INVALID_SOCKET;
@@ -449,7 +449,7 @@
     /* Check if we are connected */
     if (ret) {
         jk_log(l, JK_LOG_INFO,
-               "connect to %s failed with errno=%d",
+               "connect to %s failed (errno=%d)",
                jk_dump_hinfo(addr, buf), errno);
         jk_close_socket(sock);
         sock = JK_INVALID_SOCKET;

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?view=diff&rev=500805&r1=500804&r2=500805
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sun Jan 28 06:55:07 2007
@@ -725,7 +725,7 @@
     }
     if (!r) {
        jk_log(l, JK_LOG_ERROR,
-              "locking failed with errno=%d",
+              "locking failed (errno=%d)",
               errno);
         JK_TRACE_EXIT(l);
         return NULL;
@@ -1348,7 +1348,7 @@
     JK_INIT_CS(&(p->cs), i);
     if (i == JK_FALSE) {
         jk_log(log, JK_LOG_ERROR,
-               "creating thread lock errno=%d",
+               "creating thread lock (errno=%d)",
                errno);
         JK_TRACE_EXIT(log);
         return JK_FALSE;

Modified: tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c?view=diff&rev=500805&r1=500804&r2=500805
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c Sun Jan 28 06:55:07 2007
@@ -188,7 +188,7 @@
         JK_INIT_CS(&((*uw_map)->cs), rc);
         if (rc == JK_FALSE) {
             jk_log(l, JK_LOG_ERROR,
-                   "creating thread lock errno=%d",
+                   "creating thread lock (errno=%d)",
                    errno);
             JK_TRACE_EXIT(l);
             return JK_FALSE;
@@ -703,7 +703,7 @@
         uw_map->checked = now;
         if ((rc = stat(uw_map->fname, &statbuf)) == -1) {
             jk_log(l, JK_LOG_ERROR,
-                   "Unable to stat the %s, errno %d",
+                   "Unable to stat the %s (errno=%d)",
                    uw_map->fname, errno);
             return JK_FALSE;
         }

Modified: tomcat/connectors/trunk/jk/native/common/jk_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_worker.c?view=diff&rev=500805&r1=500804&r2=500805
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_worker.c Sun Jan 28 06:55:07 2007
@@ -56,7 +56,7 @@
     JK_INIT_CS(&worker_lock, rc);
     if (rc == JK_FALSE) {
         jk_log(l, JK_LOG_ERROR,
-                "creating thread lock errno=%d",
+                "creating thread lock (errno=%d)",
                 errno);
         JK_TRACE_EXIT(l);
         return JK_FALSE;

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=500805&r1=500804&r2=500805
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jan 28 06:55:07 2007
@@ -27,6 +27,9 @@
   <subsection name="Native">
     <changelog>
       <add>
+        <bug>41332</bug>: Add some more errno logging and unify the format. (rjung)
+      </add>
+      <add>
       JkStatus: Improved logging by adding status worker name to messages.
       Added messages to the recover worker action. (rjung)
       </add>
@@ -66,6 +69,9 @@
       <fix>
         <bug>41381</bug>: Fix segfault in feature fail_on_status
         (wrong order of log arguments). Patch by Juri Haberland. (rjung)
+      </fix>
+      <fix>
+      Use correct windows line endings for log file on WIN32 platform. (rjung)
       </fix>
     </changelog>
   </subsection>



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