Re: [c3p0-users] Connections not closed after calling close()
Status: Beta
Brought to you by:
swaldman
From: Sean R. <sea...@ne...> - 2008-03-22 02:29:27
|
Sorry to keep responding to my own thread, but I noticed that there is a comment in the AcquireTask (line 1810) which reads as follows: //we don't want this call to be sync'd //on the pool, so that resource acquisition //does not interfere with other pool clients. BasicResourcePool.this.doAcquire(); If resource acquisition isn't synchronized with the pool, doesn't that mean that it could potentially happen either during or after the pool close operation? -----Original Message----- From: c3p...@li... [mailto:c3p...@li...] On Behalf Of Sean Rohead Sent: Friday, March 21, 2008 8:07 PM To: c3p...@li... Subject: Re: [c3p0-users] Connections not closed after calling close() It seems as though there is a race-condition in the somewhere in the shutdown logic of BasicResourcePool. I added code to my application to search for the "Resource Destroyer in BasicResourcePool.close()" thread and wait until it completes. However, intermittently, the pool will acquire another connection after I have shut down the pool and the resource destroyer thread has completed. I added logging statements to the JDBC driver which logged the stack trace of the offending connection and I am certain it is from C3P0. I am intermittently seeing the following stack trace *after* the resource destroyer thread has exited. java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1206) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:51) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:119) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:143) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:132) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) BTW, I have also tried using the ScatterAcquireTask, and it did not resolve my problem. The reason I need to make absolutely sure all connections are closed is because I am trying to drop the database and it fails if there are any other connections open to the database. I would greatly appreciate anyone's help in trying to diagnose the race-condition. Thanks! ________________________________________ From: c3p...@li... [mailto:c3p...@li...] On Behalf Of Sean Rohead Sent: Friday, March 21, 2008 1:30 PM To: c3p...@li... Subject: [c3p0-users] Connections not closed after calling close() I am using a ComboPooledDataSource with a minimum pool size of 1. I am calling DataSources.destroy(dataSource) to close the pool. However, after this call returns, there is still an active connection to the database. It appears that the connections in the pool are not closed when the pool is closed (at least not synchronously). How can I force the pool to immediately close all connections to the database or block until they have all been closed? Thanks! ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ c3p0-users mailing list c3p...@li... https://lists.sourceforge.net/lists/listinfo/c3p0-users |