db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From derby-...@db.apache.org
Subject [jira] Closed: (DERBY-24) Client should not be able to raise an event on a PooledConnection it no longer owns.
Date Mon, 04 Oct 2004 16:19:33 GMT

   The following issue has been closed.

   Resolver: Daniel John Debrunner
       Date: Mon, 4 Oct 2004 9:18 AM

Fixed in commited revision 53730
View the issue:

Here is an overview of the issue:
        Key: DERBY-24
    Summary: Client should not be able to raise an event on a PooledConnection it no longer
       Type: Bug

     Status: Closed
   Priority: Minor
 Resolution: FIXED

    Project: Derby
   Fix Fors:

   Assignee: Daniel John Debrunner
   Reporter: Ramandeep Kaur

    Created: Wed, 29 Sep 2004 12:40 PM
    Updated: Mon, 4 Oct 2004 9:18 AM

Opening this bug on behalf of Daniel Debrunner.

After closing a connection Derby generates a connectionErrorOccurred() event on the PooledConnection
when a createStatement() call is made against the closed Connection.  

The code gets a Connection from the PooledConnection, creates a 
Statement, and then closes the Connection.  This causes a 
connectionClose() event, like it's supposed to.  Then it closes 
it again, which does not raise an exception (the spec doesn't 
really say what should happen if you close it twice, so it's 
hard to claim this is an error...).  A second connectionClose() 
event is not generated, which is fine.  

The testcase then calls createStatement() again on the closed 
Connection.  This generates a connectionErrorOccurred() event 
on the PooledConnection, which seems wrong.  The connection 
pool code at this point is going to figure that the 
PooledConnection is bad and needs to be discarded, even though 
it's fine.  (The second createStatement() call receives a 
SQLException, which is fine.)

The code which receives the error event has to assume that the 
event is associated with the current user of the 
PooledConnection.  When the first Connection.close() occurs, we 
will move the PooledConnection into the free pool, and then 
assign it to the next Connection requester.  If the first 
Connection client erroneously calls createStatement() on their 
closed Connection facade, the Derby Connection facade 
generates that error event which refers to the PooledConnection 
now being used by the second client.  But the code will have to 
assume that the second Connection client received an 
unrecoverable error, and that the PooledConnection needs to be 
closed, when in fact the first connection client has made a 
programming error.  There's no way for to tell which client 
caused the error.

The upshot is that any events should be generated after the close event caused by close(),
no matter what is done to that closed Connection facade, since the client's not supposed to
be using it anymore.

The reference for connection pooling semantics is: 

It doesn't explicitly say what should happen if an error occurs 
on a closed Connection, but it seems like the current behavior 
will confuse the connection pool built on top of 

This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:

If you want more information on JIRA, or have a bug to report see:

View raw message