httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: apache 2.0 on apache.org status
Date Thu, 01 Feb 2001 14:59:35 GMT
"Bill Stoddard" <bill@wstoddard.com> writes:

> > I would guess that the connection was dropped before
> > ap_new_connection() called apr_get_sockaddr(,APR_LOCAL,), thus
> > getsockname() (called by get_local_addr()) failed.
> >
> > We ignored the return code and the rest is history.
> >
> > Any ideas for verifying this hypothesis further?
> 
> Only the obvious.  Add a check for the return code and log the error when it
> happens.

Yeah, I think my tests to try to get getsockname() to fail were flawed
as I was unable to generate a TCP RST from the client (vs. TCP fin).

When I load the core into emacs I see

"4.yamato.ibm.com:8080 (Squid[Wed Jan 31 21:28:06 2001] [warn]
(54)Connection reset by peer: setsockopt: (TCP_NODELAY)"

(those IBM jerks :) )

We do this setsockopt just before the getsockname().

I think we need to run with this patch and see what we get.  Obviously
the other MPMs would need to be updated as well.

Any concerns with this code before I commit?  Hopefully the code for
other MPMs is easily modified to implement the same check.

Index: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.149
diff -u -r1.149 prefork.c
--- server/mpm/prefork/prefork.c	2001/01/31 02:15:12	1.149
+++ server/mpm/prefork/prefork.c	2001/02/01 14:48:41
@@ -1048,9 +1048,10 @@
 
 	current_conn = ap_new_connection(ptrans, ap_server_conf, csd, 
                                          my_child_num);
-
-	ap_process_connection(current_conn);
-        ap_lingering_close(current_conn);
+        if (current_conn) {
+            ap_process_connection(current_conn);
+            ap_lingering_close(current_conn);
+        }
     }
     clean_child_exit(0);
 }
Index: server/connection.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/connection.c,v
retrieving revision 1.70
diff -u -r1.70 connection.c
--- server/connection.c	2001/01/19 22:32:15	1.70
+++ server/connection.c	2001/02/01 14:48:42
@@ -67,6 +67,7 @@
 #include "mpm_status.h"
 #include "http_config.h"
 #include "http_vhost.h"
+#include "http_log.h"
 #include "util_filter.h"
 
 #ifdef HAVE_NETINET_IN_H
@@ -270,6 +271,7 @@
                             apr_socket_t *inout, long id)
 {
     conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec));
+    apr_status_t rv;
 
     /* Got a connection structure, so initialize what fields we can
      * (the rest are zeroed out by pcalloc).
@@ -279,9 +281,21 @@
     conn->notes = apr_make_table(p, 5);
 
     conn->pool = p;
-    apr_get_sockaddr(&conn->local_addr, APR_LOCAL, inout);
+    if ((rv = apr_get_sockaddr(&conn->local_addr, APR_LOCAL, inout)) 
+        != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, rv, server,
+                     "apr_get_sockaddr(APR_LOCAL)");
+        apr_close_socket(inout);
+        return NULL;
+    }
     apr_get_ipaddr(&conn->local_ip, conn->local_addr);
-    apr_get_sockaddr(&conn->remote_addr, APR_REMOTE, inout);
+    if ((rv = apr_get_sockaddr(&conn->remote_addr, APR_REMOTE, inout))
+        != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, rv, server,
+                     "apr_get_sockaddr(APR_REMOTE)");
+        apr_close_socket(inout);
+        return NULL;
+    }
     apr_get_ipaddr(&conn->remote_ip, conn->remote_addr);
     conn->base_server = server;
     conn->client_socket = inout;

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message