You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jay <jv...@comcast.net> on 2002/07/20 22:19:52 UTC

[PATCH] JDBCRealm broken pipe exception and hang condition

When using Tomcat 4.0.4 on S390 Linux I found a similar problem to bug 10000 
when using postgresql as the database.  In addition to the broken pipe 
exceptions I also saw conditions where there were no exceptions logged, basic 
authentication would just hang.   Here is a patch for Tomcat 4.0.4 that 
corrected the problem. I tested it on our S390 linux and Win2k.  I made two 
changes, first I changed two of the catch SQLException to Exception.  If any 
exceptions slips through the dbConnection is left un-usable.  To completely 
correct the problem I added a close to the dbConnection in the release 
method.  Unless there were some kind of standard "keep alive" for all 
database connections, it seems the safe thing to do is close the connection 
when authentication is done.

Could this patch be reviewed and added to the source?

Thanks for your consideration.

--- JDBCRealm.java.org	Fri Jul 19 20:04:15 2002
+++ JDBCRealm.java	Fri Jul 19 20:04:20 2002
@@ -332,7 +332,7 @@
             // Return the Principal (if any)
             return (principal);
 
-        } catch (SQLException e) {
+        } catch (Exception e) {
 
             // Log the problem for posterity
             log(sm.getString("jdbcRealm.exception"), e);
@@ -444,7 +444,7 @@
         // Close this database connection, and log any errors
         try {
             dbConnection.close();
-        } catch (SQLException e) {
+        } catch (Exception e) {
             log(sm.getString("jdbcRealm.close"), e); // Just log it here
         }

@@ -559,7 +559,7 @@
      */
     protected void release(Connection dbConnection) {

-        ; // NO-OP since we are not pooling anything
+        close(dbConnection);

     }

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