Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 58819 invoked by uid 500); 1 Feb 2001 15:00:08 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 58761 invoked from network); 1 Feb 2001 15:00:04 -0000 X-Authentication-Warning: adsl-77-241-65.rdu.bellsouth.net: trawick set sender to trawickj@bellsouth.net using -f Sender: trawick@bellsouth.net To: new-httpd@apache.org Subject: Re: apache 2.0 on apache.org status References: <00d701c08c5c$10d75040$e4421b09@raleigh.ibm.com> From: Jeff Trawick Date: 01 Feb 2001 09:59:35 -0500 In-Reply-To: "Bill Stoddard"'s message of "Thu, 1 Feb 2001 09:34:20 -0500" Message-ID: Lines: 104 User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N "Bill Stoddard" 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...