You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by al...@locus.apache.org on 2000/06/23 01:14:51 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/service/http HttpConnectionHandler.java
alex 00/06/22 16:14:51
Modified: src/share/org/apache/tomcat/service/http
HttpConnectionHandler.java
Log:
Fix bug: improperly handled SocketException or IOException during
accept() resulted in endpoint being shut down (essentially killing the
server). This bug only showed up in high-volume standalone Tomcat.
Cleaned up logging behavior.
Revision Changes Path
1.26 +23 -10 jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java
Index: HttpConnectionHandler.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- HttpConnectionHandler.java 2000/05/26 17:32:16 1.25
+++ HttpConnectionHandler.java 2000/06/22 23:14:50 1.26
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v 1.25 2000/05/26 17:32:16 costin Exp $
- * $Revision: 1.25 $
- * $Date: 2000/05/26 17:32:16 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpConnectionHandler.java,v 1.26 2000/06/22 23:14:50 alex Exp $
+ * $Revision: 1.26 $
+ * $Date: 2000/06/22 23:14:50 $
*
* ====================================================================
*
@@ -70,6 +70,7 @@
import java.util.*;
import org.apache.tomcat.core.*;
import org.apache.tomcat.util.*;
+import org.apache.tomcat.logging.*;
import javax.servlet.*;
import javax.servlet.http.*;
@@ -207,14 +208,26 @@
// do nothing - we are just cleaning up, this is
// a workaround for Netscape \n\r in POST - it is supposed
// to be ignored
- } catch(java.net.SocketException ex) {
- // do nothing - same
}
- // System.out.print("5");
- } catch (Exception e) {
- contextM.log( "Error reading request " + e.getMessage());
- e.printStackTrace();
- } finally {
+ }
+ catch(java.net.SocketException e) {
+ // SocketExceptions are normal
+ contextM.doLog( "SocketException reading request, ignored", e, Logger.INFORMATION);
+ }
+ catch (java.io.IOException e) {
+ // IOExceptions are normal
+ contextM.doLog( "IOException reading request, ignored", e, Logger.INFORMATION);
+ }
+ // Future developers: if you discover any other
+ // rare-but-nonfatal exceptions, catch them here, and log
+ // with INFORMATION level.
+ catch (Throwable e) {
+ // any other exception or error is odd. Here we log it
+ // with "ERROR" level, so it will show up even on
+ // less-than-verbose logs.
+ contextM.doLog( "Error reading request, ignored", e, Logger.ERROR);
+ }
+ finally {
// recycle kernel sockets ASAP
try { if (socket != null) socket.close (); }
catch (IOException e) { /* ignore */ }