httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject cause of bad calls to lingering_close found?
Date Wed, 22 Jan 1997 07:45:07 GMT
If you do a soft_timeout, abort_connection gets called which does a
shutdown(fd, 2) and sets c->aborted = 1.  It then continues through the
request "normally" except that aborted = 1 so lots of things just exit.
It then returns normally and does a lingering_close(), but the socket has
already been shutdown().

If you are someone who was worried about lingering_close() getting called
but the shutdown() failing, try the following (untested, uncompiled) patch
to see if it makes your problems go away and starts logging the message I
added. 

Not intended for the main tree, but if what I am thinking is right perhaps
it would be worthwhile doing something like that.

Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.108
diff -c -r1.108 http_main.c
*** http_main.c	1997/01/20 04:28:08	1.108
--- http_main.c	1997/01/22 07:41:36
***************
*** 1672,1681 ****
  #ifdef NO_LINGCLOSE
  	bclose(conn_io);	/* just close it */
  #else
! 	if (r)
! 	    lingering_close (conn_io->fd, r->server);
! 	else
! 	    close (conn_io->fd);
  #endif	
      }    
  }
--- 1672,1687 ----
  #ifdef NO_LINGCLOSE
  	bclose(conn_io);	/* just close it */
  #else
! 	if (r) {
! 	    if (!r->connection->aborted) 
! 		lingering_close (conn_io->fd, r->server);
! 	    else {
! 		log_printf(r->server, 
! 		    "skipping lingering_close because socket already shutdown()");
! 		close(conn_io->fd);
! 	    }
! 	} else
! 		close (conn_io->fd);
  #endif	
      }    
  }


Mime
View raw message