You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Roy Fielding <fi...@hyperreal.com> on 1997/02/11 16:55:22 UTC

cvs commit: apache/src CHANGES http_main.c

fielding    97/02/11 07:55:22

  Modified:    src       CHANGES http_main.c
  Log:
  Reduced timeout on lingering close, removed possibility of a blocked
  read causing the child to hang, and stopped logging of errors if
  the socket is not connected (reset by client).  This might be only a
  stopgap measure until we can rethink the accept logic.
  
  Reviewed by: Jim Jagielski, Marc Slemko
  
  Revision  Changes    Path
  1.158     +4 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.157
  retrieving revision 1.158
  diff -C3 -r1.157 -r1.158
  *** CHANGES	1997/02/10 15:49:53	1.157
  --- CHANGES	1997/02/11 15:55:19	1.158
  ***************
  *** 1,5 ****
  --- 1,9 ----
    Changes with Apache 1.2b7
    
  +   *) Reduced timeout on lingering close, removed possibility of a blocked
  +      read causing the child to hang, and stopped logging of errors if
  +      the socket is not connected (reset by client).  [Roy Fielding]
  + 
      *) Extensive performance improvements. Cleaned up inefficient use of
         auto initializers, multiple is_matchexp calls on a static string,
         and excessive merging of response_code_strings. [Dean Gaudet]
  
  
  
  1.119     +16 -9     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -C3 -r1.118 -r1.119
  *** http_main.c	1997/02/10 21:22:20	1.118
  --- http_main.c	1997/02/11 15:55:20	1.119
  ***************
  *** 322,332 ****
    
        kill_timeout(r);     /* Remove any leftover timeouts */
    
  !     /* Close our half of the connection --- send client a FIN */
    
  !     if ((shutdown(sd, 1)) != 0) {
    	/* if it fails, no need to go through the rest of the routine */
  ! 	log_unixerr("shutdown", NULL, "lingering_close", r->server);
    	close(sd);
    	return;
        }
  --- 322,335 ----
    
        kill_timeout(r);     /* Remove any leftover timeouts */
    
  !     /* Close our half of the connection --- send client a FIN and
  !      * set the socket to non-blocking for later reads.
  !      */
    
  !     if (((shutdown(sd, 1)) != 0) || (fcntl(sd, F_SETFL, FNDELAY) == -1)) {
    	/* if it fails, no need to go through the rest of the routine */
  ! 	if (errno != ENOTCONN)
  ! 	    log_unixerr("shutdown", NULL, "lingering_close", r->server);
    	close(sd);
    	return;
        }
  ***************
  *** 348,359 ****
        hard_timeout("lingering_close", r);
    
        do {
  ! 	/* If keep_alive_timeout is too low, using it as a timeout
  ! 	 * can cause undesirable behavior so pick some pseudo-arbitrary
  ! 	 * minimum value, currently 10 seconds.  These parameters are
  !          * reset on each pass, since they may be changed by select.
  ! 	 */
  !         tv.tv_sec  = max(r->server->keep_alive_timeout, 10);
            tv.tv_usec = 0;
            read_rv    = 0;
            fds_read   = fds;
  --- 351,366 ----
        hard_timeout("lingering_close", r);
    
        do {
  !         /* We use a 1 second timeout because current (Feb 97) browsers
  !          * fail to close a connection after the server closes it.  Thus,
  !          * to avoid keeping the child busy, we are only lingering long enough
  !          * for a client that is actively sending data on a connection.
  !          * This should be sufficient unless the connection is massively
  !          * losing packets, in which case we might have missed the RST anyway.
  !          * These parameters are reset on each pass, since they might be
  !          * changed by select.
  !          */
  !         tv.tv_sec  = 1;
            tv.tv_usec = 0;
            read_rv    = 0;
            fds_read   = fds;
  
  
  

Re: cvs commit: apache/src CHANGES http_main.c

Posted by Marc Slemko <ma...@znep.com>.
Do you think setsockopt TCP_NODELAY is portable too?

If so, see the ifdef for MPE and the bug report for "UNIX SVR4 MP RAS"
that came through the other week; ie. won't compile due to no TCP_NODELAY.

It is arguable that not being able to set it is an offence worthy of
suicide; if so, current is fine.  If not, it should be wrapped by an
ifdef.  

I am going to suggest the same thing for TCP_NODELAY when I get to it,
because failing there is certainly not worthy of suicide. 

On Tue, 11 Feb 1997, Dean Gaudet wrote:

> I've used fcntl( FNDELAY ) in mud code on: dynix/ptx (2.something, the
> sysvr3 one), linux, sunos, solaris, irix, ultrix, bsdi... I think that's
> it.  Oh yeah one of my developers used to work on a hpux box.  So I think
> it's pretty portable. 
> 
> I do recall needed to test for both EWOULDBLOCK and EAGAIN to get maximum
> portability.
> 
> Dean
> 
> On Tue, 11 Feb 1997, Marc Slemko wrote:
> 
> > Is the fcntl 100% portable?  Should it be wrapped in an ifdef FNDELAY?
> > 
> > On Tue, 11 Feb 1997, Roy Fielding wrote:
> > 
> > >   --- 322,335 ----
> > >     
> > >         kill_timeout(r);     /* Remove any leftover timeouts */
> > >     
> > >   !     /* Close our half of the connection --- send client a FIN and
> > >   !      * set the socket to non-blocking for later reads.
> > >   !      */
> > >     
> > >   !     if (((shutdown(sd, 1)) != 0) || (fcntl(sd, F_SETFL, FNDELAY) == -1)) {
> > >     	/* if it fails, no need to go through the rest of the routine */
> > >   ! 	if (errno != ENOTCONN)
> > >   ! 	    log_unixerr("shutdown", NULL, "lingering_close", r->server);
> > >     	close(sd);
> > >     	return;
> > 
> > 
> 


Re: cvs commit: apache/src CHANGES http_main.c

Posted by Dean Gaudet <dg...@arctic.org>.
I've used fcntl( FNDELAY ) in mud code on: dynix/ptx (2.something, the
sysvr3 one), linux, sunos, solaris, irix, ultrix, bsdi... I think that's
it.  Oh yeah one of my developers used to work on a hpux box.  So I think
it's pretty portable. 

I do recall needed to test for both EWOULDBLOCK and EAGAIN to get maximum
portability.

Dean

On Tue, 11 Feb 1997, Marc Slemko wrote:

> Is the fcntl 100% portable?  Should it be wrapped in an ifdef FNDELAY?
> 
> On Tue, 11 Feb 1997, Roy Fielding wrote:
> 
> >   --- 322,335 ----
> >     
> >         kill_timeout(r);     /* Remove any leftover timeouts */
> >     
> >   !     /* Close our half of the connection --- send client a FIN and
> >   !      * set the socket to non-blocking for later reads.
> >   !      */
> >     
> >   !     if (((shutdown(sd, 1)) != 0) || (fcntl(sd, F_SETFL, FNDELAY) == -1)) {
> >     	/* if it fails, no need to go through the rest of the routine */
> >   ! 	if (errno != ENOTCONN)
> >   ! 	    log_unixerr("shutdown", NULL, "lingering_close", r->server);
> >     	close(sd);
> >     	return;
> 
> 


Re: cvs commit: apache/src CHANGES http_main.c

Posted by Marc Slemko <ma...@znep.com>.
Is the fcntl 100% portable?  Should it be wrapped in an ifdef FNDELAY?

On Tue, 11 Feb 1997, Roy Fielding wrote:

>   --- 322,335 ----
>     
>         kill_timeout(r);     /* Remove any leftover timeouts */
>     
>   !     /* Close our half of the connection --- send client a FIN and
>   !      * set the socket to non-blocking for later reads.
>   !      */
>     
>   !     if (((shutdown(sd, 1)) != 0) || (fcntl(sd, F_SETFL, FNDELAY) == -1)) {
>     	/* if it fails, no need to go through the rest of the routine */
>   ! 	if (errno != ENOTCONN)
>   ! 	    log_unixerr("shutdown", NULL, "lingering_close", r->server);
>     	close(sd);
>     	return;