You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Leon Messerschmidt <le...@opticode.co.za> on 2001/03/15 11:48:23 UTC

Connection Pool Bug

 Hi,

 I get an sql (connection closed) exception when using a new Turbine CVS.
It
 does this with both MySQL/Linux and Interbase/Win2K.  I think I've found a
 problem with the dbConnecion.

 For some reason my connection becomes invalid (I'd like to know why this
 happens in the first place :-).  When the DBPool Tries to close the invalid
 connection it throws an exception because the connection is already closed.
 The problem is that the close() method call the getConnection() method,
 which throws an exception on a closed connection. Here is a proposed Patch:

 RCS file:

/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/db/pool/DBConnect
 ion.java,v
 retrieving revision 1.17
 diff -r1.17 DBConnection.java
 507d506
 <         Connection conn = getConnection();
 510c509
 <             if ( conn != null && !conn.isClosed() )
 ---
 >             if ( connection != null && !connection.isClosed() )
 512c511
 <                 conn.close();
 ---
 >                 connection.close();

 ~ Leon

 Horrible Exception: java.sql.SQLException: Connection is closed!
         at

org.apache.turbine.util.db.pool.DBConnection.getConnection(DBConnection.java
 , Compiled Code)
         at
 org.apache.turbine.util.db.pool.DBConnection.close(DBConnection.java,
 Compiled Code)
         at

org.apache.turbine.util.db.pool.ConnectionPool.popConnection(ConnectionPool.
 java, Compiled Code)
         at

org.apache.turbine.util.db.pool.ConnectionPool.getInternalPooledConnection(C
 onnectionPool.java, Compiled Code)
         at

org.apache.turbine.util.db.pool.ConnectionPool.getConnection(ConnectionPool.
 java, Compiled Code)
         at

org.apache.turbine.services.db.TurbinePoolBrokerService.getConnection(Turbin
 ePoolBrokerService.java, Compiled Code)
         at
 org.apache.turbine.services.db.TurbineDB.getConnection(TurbineDB.java,
 Compiled Code)
         at org.apache.turbine.om.peer.BasePeer.executeQuery(BasePeer.java,
 Compiled Code)
         at org.apache.turbine.om.peer.BasePeer.doSelect(BasePeer.java,
 Compiled Code)
         at

org.apache.turbine.om.security.peer.TurbineUserPeer.doSelect(TurbineUserPeer
 .java, Compiled Code)
         at

org.apache.turbine.om.security.peer.TurbineUserPeer.doSelect(TurbineUserPeer
 .java, Compiled Code)
         at

org.apache.turbine.services.security.DBUserManager.retrieve(DBUserManager.ja
 va, Comppilde Code)



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Connection Pool Bug

Posted by Sean Legassick <se...@informage.net>.
In message <3A...@collab.net>, John McNally 
<jm...@collab.net> writes
>Jon applied this patch as 1.14->1.15?  I think it must have been lost
>during the update to j2ee style connections.
>
>Please reapply ASAP!

Sorry about that - my bad. I did check through changes since the files 
that Costas based his patches on, but I must have missed this one.

Sorry, and thanks for fixing it Leon. I'll do a check to make sure 
nothing else got lost.

Sean

-- 
Sean Legassick
sean@informage.net
         ignorance is not bliss

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: Connection Pool Bug

Posted by John McNally <jm...@collab.net>.
Jon applied this patch as 1.14->1.15?  I think it must have been lost
during the update to j2ee style connections.

Please reapply ASAP!

John McNally

> 
>  RCS file:
> 
> /home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/db/pool/DBConnect
>  ion.java,v
>  retrieving revision 1.17
>  diff -r1.17 DBConnection.java
>  507d506
>  <         Connection conn = getConnection();
>  510c509
>  <             if ( conn != null && !conn.isClosed() )
>  ---
>  >             if ( connection != null && !connection.isClosed() )
>  512c511
>  <                 conn.close();
>  ---
>  >                 connection.close();
> 
>  ~ Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org