You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by hg...@apache.org on 2002/11/20 15:16:46 UTC

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common ChannelSocket.java

hgomez      2002/11/20 06:16:46

  Modified:    jk/java/org/apache/jk/common ChannelSocket.java
  Log:
  When a socket timeout exception appears 
  (why set timeout for ajp13 connections ?), the socket is not closed,
  and even if tomcat remove the thread the socket is still open and make
  webserver stuck while waiting replies to request which are no more monitored !!!!
  
  Revision  Changes    Path
  1.26      +18 -4     jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java
  
  Index: ChannelSocket.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ChannelSocket.java	31 Oct 2002 00:54:57 -0000	1.25
  +++ ChannelSocket.java	20 Nov 2002 14:16:46 -0000	1.26
  @@ -554,14 +554,28 @@
                       break;
                   }
               }
  -            this.close( ep );
           } catch( Exception ex ) {
  -            if( ex.getMessage().indexOf( "Connection reset" ) >=0 ) {
  +            if( ex.getMessage().indexOf( "Connection reset" ) >=0 ||
  +                ex.getMessage().indexOf( "Read timed out" ) >=0 ) 
                   log.info( "Server has been restarted or reset this connection");
  -            } else {
  +            else
  +                log.error( "Error, processing connection", ex);
  +        }
  +	    finally {
  +	    	
  +	    	/*
  +	    	 * Whatever happened to this connection (remote closed it, timeout, read error)
  +	    	 * the socket SHOULD be closed, or we may be in situation where the webserver
  +	    	 * will continue to think the socket is still open and will forward request
  +	    	 * to tomcat without receiving ever a reply
  +	    	 */
  +            try {
  +                this.close( ep );
  +            }
  +            catch( Exception ex) {
                   log.error( "Error, closing connection", ex);
               }
  -        }
  +	    }
       }
   
       public int invoke( Msg msg, MsgContext ep ) throws IOException {
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>