Issue Details (XML | Word | Printable)

Key: JDBC-86
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Mark Rotteveel
Reporter: Ludovic Orban
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

Regression: FBConnectionPoolDataSource throws FBSQLException when connections are re-used

Created: 19/Aug/06 12:25 PM   Updated: 02/Sep/12 11:11 AM
Component/s: Connection pool
Affects Version/s: Jaybird 2.1
Fix Version/s: Jaybird 3.0.0

Issue Links:
Relate
 


 Description  « Hide
You sporadically get this exception when you call XAConnection.getConnection() on XAConnection obtained from FBConnectionPoolDataSource:

org.firebirdsql.jdbc.FBSQLException: Physical connection is currently in pool, you cannot allocate logical connections now.
        at org.firebirdsql.pool.PingablePooledConnection.checkInPool(PingablePooledConnection.java:225)
        at org.firebirdsql.pool.PingablePooledConnection.getConnection(PingablePooledConnection.java:341)
...

I could not trace down what exactly causes this exception to be thrown but it seems to happen when a connection from the pool is being reused, ie: when it has already been closed once and is being taken by the pool due to a call to open().

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Roman Rokytskyy added a comment - 18/Oct/07 04:08 AM
Could not reproduce yet...

Mark Rotteveel added a comment - 22/Jul/11 11:38 AM
Able to reproduce this with a client similar to the one in JDBC-93. I get either the error in this issue, or the error in JDBC-144

Mark Rotteveel added a comment - 22/Jul/11 04:53 PM
Problem is that FBConnectionPoolDataSource and related implementations are also connection pools themselves. The implementation of the resource handling returns PooledConnections to the internal pool when the logical Connection created from the PooledConnections is closed. This causes the error as the Jaybird connection pool thinks the PooledConnection has been returned to the pool, while in reality the PooledConnection is still owned by the AS. I am still looking at the current implementation to see what needs to be done to fix this.

Ludovic Orban added a comment - 22/Jul/11 05:45 PM
Please keep in mind that XAConnection's returned by XADataSource should not be pooled.

Mark Rotteveel added a comment - 22/Jul/11 09:57 PM
The XAConnection itself shouldn't be pooled but the underlying physical connection is allowed to be pooled. The problem is mainly with the way the closure of the logical connection (delivered to the client) is handled.

Ludovic Orban added a comment - 23/Jul/11 01:24 PM
Pooling is supposed to be done at a higher level, not at a lower one. Check the javax.sql.PooledConnection javadoc which javax.sql.XADataSource extends: http://download.oracle.com/javase/1.4.2/docs/api/javax/sql/PooledConnection.html

The JDBC driver is not supposed to pool the Connection objects returned by XAConnection.getConnection(), those are physical connections and it's up to the connection pool to decide when to recycle the physical connections or close them.

This is exactly what I tried implementing in org.firebirdsql.jca.FBXADataSource but I never found the time to properly test the code.

Mark Rotteveel added a comment - 27/Aug/11 12:04 PM
Removed Fix version; for Jaybird 2.2 use org.firebirdsql.ds.FBConnectionPoolDataSource instead.

This class is considered for removal in Jaybird version after 2.2

Mark Rotteveel added a comment - 02/Sep/12 11:11 AM
Eliminated deprecated datasources from org.firebirdsql.pool