Bug 51786 - Discarded connection stay active in pool
Discarded connection stay active in pool
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool
PC Linux
: P2 major (vote)
: ---
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2011-09-08 11:50 UTC by seneque
Modified: 2011-09-14 09:30 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description seneque 2011-09-08 11:50:52 UTC
I wrote an JdbcInterceptor that flag connection as discarded in case of Exception that makes the connection unusable.
The problem is:
when I call close on the connection, it is not returned to the pool and it is still considered as an active connection in the pool.
The cause of the problem is those pieces of code in ProxyConnection:

if (compare(CLOSE_VAL,method)) {
            if (isClosed()) return null; //noop for already closed.
            PooledConnection poolc = this.connection;
            this.connection = null;
            return null;


public boolean isClosed() {
        return connection==null || connection.isDiscarded();
Comment 1 Keiichi Fujino 2011-09-14 09:30:45 UTC
Thanks for report.
This is  fixed in r1170479 and r1170485 and  will be in 7.0.22 onwards.