-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: C3P0 pool limit got busted
PostPosted: Fri Nov 03, 2006 4:49 pm 
Newbie

Joined: Mon Dec 05, 2005 1:03 pm
Posts: 10
Hibernate version: 3.0.5

C3P0 version: c3p0-0.9.1-pre6

Configuration:
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.acquire_increment=5
hibernate.c3p0.max_statements=50
hibernate.c3p0.timeout=5000
hibernate.c3p0.idle_test_period=1800

Configuration (extras):
c3p0.checkoutTimeout=5000
c3p0.numHelperThreads=10
c3p0.acquireRetryAttempts=10
c3p0.acquireRetryDelay=1000

I'm using PostgreSQL 8.1.1 as the database, and its connection limit has been set to 100.

From time to time, I'd get an exception from the postgresql jdbc driver saying "connection limit exceeded". I checked and the DB connections and the limit (100) was reached indeed, even though c3p0's limit is 20. Why did the pool's limit get busted?

I did check my code for session closures and make sure there is a session.close() in the "finally" block. However, even if I did forget one, the pool's limit should never have got busted in the first place.

Any help would be appreciated.
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 06, 2006 11:41 am 
Newbie

Joined: Mon Dec 05, 2005 1:03 pm
Posts: 10
The info below was mentioned in the release notes for c3p0-0.9.1-pre10 :
Quote:
[...]
Fixed a bug whereby multiple near-simultaneous Connection requests failed
to provoke sufficient pool growth/Connection acquisition. This is a bug
reintroduced in c3p0-0.9.1-pre4, and is a duplicate of an early issue,
resolved under the old pool size management scheme. c3p0 must (and does)
keep track not only of its current size and pending growth, but also the
number of potentially unserved recent Connection requests. c3p0-0.9.1-pre4
thru c3p0-0.9.1-pre9 failed to make use of the incoming request count when
deciding whether and how much to grow the pool. Many thanks to John Kristian
for calling attention to this subtle issue.
[...]


Does this bug mean the pool was not growing the pool when it should? Or was it growing the pool when it shouldn't? Or both?

Any c3p0 gurus out there, please advise.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 06, 2006 1:19 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
lukeda,

the bug description you quote had to do with the pool growing too slowly, not exceeding its maximum size. i know of no issue where c3p0 pools fail to honor maxPoolSize. that would be a serious issue.

do you have any information on the state of your c3p0 data source when you are getting these messages? you can get some info by turning on DEBUG level logging for loggers [com.mchange.*], by using the various methods of com.mchange.v2.c3p0.PooledDataSource, or via a JMX mbean under jdk1.5+ (try jconsole, if you are using 1.5+).

if somehow connections were not properly closed by your application, one would expect to see pool exhaustion (the app would simply fail to receive connections) rather than too many cxns checked out. so it's a mystery.

are you sure there are not other apps checking out from the db at the same time? or does your app check-out cxns on behalf of multiple users? if user alice and user bill both checkout cxns via the same c3p0 datasource [with at least one of them calling getConnection(user, password)], then this results in two distinct connection pools, each of with having a maxPoolSize of 20. so, if there are more than 5 different connection authenticators, you could exceed your database's client limit.

anyway, i doubt that's it. please get more detailed info about what's happening at the c3p0 level, and we'll see if we can make sense of this. (also please include c3p0's initial config dump in your report, so we can be sure that the config params you are setting are the ones that c3p0 is seeing).

smiles,
Steve


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 06, 2006 5:48 pm 
Newbie

Joined: Mon Dec 05, 2005 1:03 pm
Posts: 10
Thank you Steve for the clarifications. Although I'm experienced in Java, I'm a hibernate/c3p0 newbie and not really familiar with the JMX/JConsole feature in JDK 1.5. But I'll try it out so that I can give you more info.

On the other hand, what you mentioned about multiple distinct pools could make sense. My app has a "retry" routine that closes and recreates Hibernate session factory on a fixed interval of time in cases where the DB is not available. If the session factory doesn't close quick enough, then there'd be multiple instances of them, and therefore multiple pools, right?

Maybe what I'm doing is not the correct way. I've included a snippet of my code below for reference.

Code:
   public synchronized DatabaseManager start(boolean forced) {
      if (log.isInfoEnabled()) {
         log.info("start - forced=" + forced + ", started=" + started);
      }

      if (forced || !isStarted()) {
         setStarted(false);

         cleanup();

         log.warn("start - building new session factory");
         
         sessionFactory = rebuildConfiguration().buildSessionFactory();
         
         try {
            createSchema();  // config must have been set up before this call
         } catch (Exception x) {
            throw new GSMDatabaseException("failed to load schema definition", x);
         }
      }
     
      setStarted(true);
     
      errorDetected = false;
     
      return this;
   }

   public synchronized void shutdown() {
      if (log.isInfoEnabled())
         log.info("shutdown - " + this);

      cleanup();
      setStarted(false);
   }
   
   private synchronized void cleanup() {
     
      log.warn("cleanup - closing session factory: " + sessionFactory);
     
      // Close the session factory.
      // On rare occasions it blocks while closing (no deadlock) so we'd
      // rather do this on a separate thread to avoid blocking the operations.
      // TODO: Abort if it takes too long to close.
      final SessionFactory sf = sessionFactory;
     
      if (sf != null) {
         sessionFactory = null;
         
         ThreadPool.start(new Runnable() {
            public void run() {
               closeSessionFactory(sf);
            }
         }, "HbDatabaseManager - close session factory");
      }
     
   }

   private static void closeSessionFactory(SessionFactory sf) {
      if (log.isInfoEnabled())
         log.info("closeSessionFactory - " + sf);
     
      if (sf != null) {
         try {
            if (!sf.isClosed()) {
               log.warn("closeSessionFactory - closing");
               sf.close();
               log.info("closeSessionFactory - closed");
            }
         } catch (Exception x) {
            log.error("closeSessionFactory - close failed - ignored", x);
         }
      }
   }


Thanks again for your great work and for the informative reply.


Top
 Profile  
 
 Post subject: RESOURCE POOL IS PERMANENTLY BROKEN
PostPosted: Tue Nov 07, 2006 4:36 pm 
Newbie

Joined: Mon Dec 05, 2005 1:03 pm
Posts: 10
Steve,
I was trying to remove any possibility of multiple pool instances, and while testing the code by doing restarts on the database server, I got the error about "RESOURCE POOL IS PERMANENTLY BROKEN" (see below) after a stop+restart. I don't think it's due to c3p0.breakAfterAcquireFailure=true because I tried to reproduce it without success. Besides, it also says "Unexpectedly broken".

log4j output:
Code:
[Thread-20] WARN  org.hibernate.util.JDBCExceptionReporter  - SQL Error: 0, SQLState: 08006
[Thread-20] ERROR org.hibernate.util.JDBCExceptionReporter  - An I/O error occured while sending to the backend.
[Thread-20] ERROR com.miranda.icontrol.gsm.server.plugins.consumers.SQLLogPlugin  - saveEvents - failed to save class com.miranda.icontrol.gsm.common.AlarmImpl@17243991[descriptor=APL Limit Max;previousState=10|20|20/0;state=20|20|20/0;timestamp=Tue Nov 07 14:47:44 EST 2006]
[Timer-7] WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@9aa3f3 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
[Timer-7] WARN  com.mchange.v2.async.ThreadPoolAsynchronousRunner  - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@9aa3f3 -- APPARENT DEADLOCK!!! Complete Status:
   Managed Threads: 5
   Active Threads: 5
   Active Tasks:
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1787395 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ec7c94 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1e6f7cb (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@965654 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1fdd342 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3)
   Pending Tasks:
      com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@138b4ed
Pool thread stack traces:
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,RMI Runtime]
      java.net.PlainSocketImpl.socketConnect(Native Method)
      java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      java.net.Socket.connect(Socket.java:516)
      java.net.Socket.connect(Socket.java:466)
      java.net.Socket.<init>(Socket.java:366)
      java.net.Socket.<init>(Socket.java:179)
      org.postgresql.core.PGStream.<init>(PGStream.java:60)
      org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
      org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
      org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
      org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
      org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
      org.postgresql.Driver.makeConnection(Driver.java:369)
      org.postgresql.Driver.connect(Driver.java:245)
      com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
      com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
      com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4,5,RMI Runtime]
      java.net.PlainSocketImpl.socketConnect(Native Method)
      java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      java.net.Socket.connect(Socket.java:516)
      java.net.Socket.connect(Socket.java:466)
      java.net.Socket.<init>(Socket.java:366)
      java.net.Socket.<init>(Socket.java:179)
      org.postgresql.core.PGStream.<init>(PGStream.java:60)
      org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
      org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
      org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
      org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
      org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
      org.postgresql.Driver.makeConnection(Driver.java:369)
      org.postgresql.Driver.connect(Driver.java:245)
      com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
      com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
      com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,RMI Runtime]
      java.net.PlainSocketImpl.socketConnect(Native Method)
      java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      java.net.Socket.connect(Socket.java:516)
      java.net.Socket.connect(Socket.java:466)
      java.net.Socket.<init>(Socket.java:366)
      java.net.Socket.<init>(Socket.java:179)
      org.postgresql.core.PGStream.<init>(PGStream.java:60)
      org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
      org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
      org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
      org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
      org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
      org.postgresql.Driver.makeConnection(Driver.java:369)
      org.postgresql.Driver.connect(Driver.java:245)
      com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
      com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
      com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3,5,RMI Runtime]
      java.net.PlainSocketImpl.socketConnect(Native Method)
      java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      java.net.Socket.connect(Socket.java:516)
      java.net.Socket.connect(Socket.java:466)
      java.net.Socket.<init>(Socket.java:366)
      java.net.Socket.<init>(Socket.java:179)
      org.postgresql.core.PGStream.<init>(PGStream.java:60)
      org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
      org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
      org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
      org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
      org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
      org.postgresql.Driver.makeConnection(Driver.java:369)
      org.postgresql.Driver.connect(Driver.java:245)
      com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
      com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
      com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
   Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,RMI Runtime]
      java.net.PlainSocketImpl.socketConnect(Native Method)
      java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      java.net.Socket.connect(Socket.java:516)
      java.net.Socket.connect(Socket.java:466)
      java.net.Socket.<init>(Socket.java:366)
      java.net.Socket.<init>(Socket.java:179)
      org.postgresql.core.PGStream.<init>(PGStream.java:60)
      org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
      org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
      org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
      org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
      org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
      org.postgresql.Driver.makeConnection(Driver.java:369)
      org.postgresql.Driver.connect(Driver.java:245)
      com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
      com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
      com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
      com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
      com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
      com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
      com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)


[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1fdd342 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (10). Last acquisition attempt exception:
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
   at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:369)
   at org.postgresql.Driver.connect(Driver.java:245)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:516)
   at java.net.Socket.connect(Socket.java:466)
   at java.net.Socket.<init>(Socket.java:366)
   at java.net.Socket.<init>(Socket.java:179)
   at org.postgresql.core.PGStream.<init>(PGStream.java:60)
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
   ... 14 more
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - A RESOURCE POOL IS PERMANENTLY BROKEN! [com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1fdd342]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- Unexpectedly broken!!!
com.mchange.v2.resourcepool.ResourcePoolException: Unexpected Break Stack Trace!
   at com.mchange.v2.resourcepool.BasicResourcePool.unexpectedBreak(BasicResourcePool.java:777)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1639)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
[Thread-20] WARN  org.hibernate.util.JDBCExceptionReporter  - SQL Error: 0, SQLState: null
[Thread-20] ERROR org.hibernate.util.JDBCExceptionReporter  - An SQLException was provoked by the following failure: java.lang.InterruptedException
[Thread-20] ERROR com.miranda.icontrol.gsm.server.plugins.consumers.SQLLogPlugin  - saveEvents - failed to save class com.miranda.icontrol.gsm.common.AlarmImpl@28218725[descriptor=CC/TT Presence;previousState=20|20|20/0;state=10|20|20/0;timestamp=Tue Nov 07 14:47:49 EST 2006]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ec7c94 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (10). Last acquisition attempt exception:
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
   at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:369)
   at org.postgresql.Driver.connect(Driver.java:245)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:516)
   at java.net.Socket.connect(Socket.java:466)
   at java.net.Socket.<init>(Socket.java:366)
   at java.net.Socket.<init>(Socket.java:179)
   at org.postgresql.core.PGStream.<init>(PGStream.java:60)
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
   ... 14 more
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - A RESOURCE POOL IS PERMANENTLY BROKEN! [com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@ec7c94]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- Unexpectedly broken!!!
com.mchange.v2.resourcepool.ResourcePoolException: Unexpected Break Stack Trace!
   at com.mchange.v2.resourcepool.BasicResourcePool.unexpectedBreak(BasicResourcePool.java:777)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1639)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- close() called multiple times.
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1787395 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (10). Last acquisition attempt exception:
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
   at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:369)
   at org.postgresql.Driver.connect(Driver.java:245)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:516)
   at java.net.Socket.connect(Socket.java:466)
   at java.net.Socket.<init>(Socket.java:366)
   at java.net.Socket.<init>(Socket.java:179)
   at org.postgresql.core.PGStream.<init>(PGStream.java:60)
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
   ... 14 more
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - A RESOURCE POOL IS PERMANENTLY BROKEN! [com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1787395]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- Unexpectedly broken!!!
com.mchange.v2.resourcepool.ResourcePoolException: Unexpected Break Stack Trace!
   at com.mchange.v2.resourcepool.BasicResourcePool.unexpectedBreak(BasicResourcePool.java:777)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1639)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- close() called multiple times.
[Thread-20] WARN  org.hibernate.util.JDBCExceptionReporter  - SQL Error: 0, SQLState: null
[Thread-20] ERROR org.hibernate.util.JDBCExceptionReporter  - An SQLException was provoked by the following failure: com.mchange.v2.resourcepool.ResourcePoolException: Attempted to use a closed or broken resource pool
[Thread-20] ERROR com.miranda.icontrol.gsm.server.plugins.consumers.SQLLogPlugin  - saveEvents - failed to save class com.miranda.icontrol.gsm.common.AlarmImpl@9043557[descriptor=Chroma Limit Max;previousState=10|20|20/0;state=20|20|20/0;timestamp=Tue Nov 07 14:48:02 EST 2006]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1e6f7cb -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (10). Last acquisition attempt exception:
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
   at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:369)
   at org.postgresql.Driver.connect(Driver.java:245)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:516)
   at java.net.Socket.connect(Socket.java:466)
   at java.net.Socket.<init>(Socket.java:366)
   at java.net.Socket.<init>(Socket.java:179)
   at org.postgresql.core.PGStream.<init>(PGStream.java:60)
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
   ... 14 more
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - A RESOURCE POOL IS PERMANENTLY BROKEN! [com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1e6f7cb]
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] ERROR com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- Unexpectedly broken!!!
com.mchange.v2.resourcepool.ResourcePoolException: Unexpected Break Stack Trace!
   at com.mchange.v2.resourcepool.BasicResourcePool.unexpectedBreak(BasicResourcePool.java:777)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1639)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool@f0d3a6 -- close() called multiple times.
[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@965654 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (10). Last acquisition attempt exception:
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:122)
   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:65)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:116)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
   at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:369)
   at org.postgresql.Driver.connect(Driver.java:245)
   at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
   at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
   at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:135)
   at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:925)
   at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:32)
   at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1602)
   at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
   at java.net.Socket.connect(Socket.java:516)
   at java.net.Socket.connect(Socket.java:466)
   at java.net.Socket.<init>(Socket.java:366)
   at java.net.Socket.<init>(Socket.java:179)
   at org.postgresql.core.PGStream.<init>(PGStream.java:60)
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:77)
   ... 14 more


Configuration:

Code:
# Connection pool settings (using C3P0) - see http://www.mchange.com/projects/c3p0/
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.acquire_increment=5
hibernate.c3p0.max_statements=100
hibernate.c3p0.timeout=3600
hibernate.c3p0.idle_test_period=1800

# These should've been in c3p0.properties, they can be centralized here because
# the database manager (HbDatabaseManager) is supposed to intialize them on startup.
c3p0.checkoutTimeout=5000
c3p0.numHelperThreads=5
c3p0.acquireRetryAttempts=10
c3p0.acquireRetryDelay=1000
c3p0.breakAfterAcquireFailure=true

# Pools shrink to their minimum size if unused for X seconds (since 0.9.1-pre7)
c3p0.maxIdleTimeExcessConnections=60
# Kill leaked connections that aren't checked in after X seconds (since 0.9.1-pre7)
c3p0.unreturnedConnectionTimeout=60
# See what check-out in your app potentially fails to check back in (since 0.9.1-pre7)
c3p0.debugUnreturnedConnectionStackTraces=true

# SQL dialect
#hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

# Change these options for debugging or deployment purposes
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.use_sql_comments=true

# Uncomment these lines to completely disable the respective cache
#hibernate.cache.use_query_cache=false
hibernate.cache.use_second_level_cache=false


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 07, 2006 6:47 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
lukeda,

it was "c3p0.breakAfterAcquireFailure=true" that killed you here. From the resource pool's perspective, any time a pool is permanently marked broken without having been explicitly close()ed by a user, it's an expected break.

in the long listing above, what's going on is this:

1) you shut down the database. c3p0 tries to acquire Connections. some of these acquisition attempts are freezing rather than failing with an Exception, provoking the APPARENT DEADLOCK error.

[to resolve this, you can put a time limit on how long an acquisition attempt can hang via c3p0.maxAdministrativeTaskTime (since c3p0-0.9.1-pre7), which will cause tasks that fail to terminate properly to receive a Thread.interrupt() after the set time. 5 seconds is a good number. eventually these tasks do get interrupt()ed, but only after they have deemed to be deadlocked.]

2) eventually, a full round of acquisition attempts (10 in your case) fails. since c3p0.breakAfterAcquireFailure=true, the pool marks itself "unexpectedly broken" and all future attempts to work with it fail.

anyway, in practical terms, if you want c3p0 to survive database shutdowns and restarts, it's a good idea to leave "c3p0.breakAfterAcquireFailure=false", which is the default. for databases whose Connection acquisition attempts sometimes neither succeed nor fail promptly, setting c3p0.maxAdministrativeTaskTime=5-ish is a good idea too.

i'm not sure from your code whether you end up creating multiple pools, but you can test this (and log or fail if you are making more pools than you want) by using C3P0Registry methods, if the JMX stuff is inconvenient. C3P0Registry.allPooledDataSources().size() will tell you how many pools are currently running in the current VM (ClassLoader). If your app might be using non-default authentification information [i.e. explicitly calling dataSource.getConnection(user, pass)], there may be more than one pool per DataSource. I don't think hibernate's C3P0ConnectionProvider ever does this. But, if your app somehow does use multiple authentification info, code like this would give you the full pool count:

Code:
import com.mchange.v2.c3p0.*;

...

int getC3P0TotalPoolCount()
{
  int count = 0;
  for (Iterator ii = C3P0Registry.allPooledDataSources(); ii.hasNext();)
  {
      PooledDataSource pds = (PooledDataSource) ii.next();
      count += pds.getNumUserPools();
  }
  return count;
}


I'll try to add a convenience method in C3P0Registry (and its associated MBean) for getting this information.

Good luck!
Steve


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 07, 2006 11:24 pm 
Newbie

Joined: Mon Dec 05, 2005 1:03 pm
Posts: 10
Steve,

Once again, you've provided another of those detailed and to-the-point answers. I'm glad to hear that the "unexpectedly broken" message was due to the "c3p0.breakAfterAcquireFailure=true" setting. No more uncertainty.

I think I've located the root cause of my original problem. As you can see in my code snippet, the session factory was being closed within a thread (so it won't delay the "restart" routine, because sometimes sessionFactory.close() takes a while to complete). I was able to reproduce the problem by explicitly delaying the closing of the session factory, in which case a new pool was being created in addition to the previous one.

I'll include your code snippet for getting the total pool count into my app for sure. It'd be great for troubleshooting.

Thanks again for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 2:55 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Errr... in my post above, it should have said "From the resource pool's perspective, any time a pool is permanently marked broken without having been explicitly close()ed by a user, it's an unexpected break." Oops!

I'm glad despite my gaffes, you were able to make sense of things and resolve your problem!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 3:19 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Errr... in my post above, it should have said "From the resource pool's perspective, any time a pool is permanently marked broken without having been explicitly close()ed by a user, it's an unexpected break." Oops!

I'm glad despite my gaffes, you were able to make sense of things and resolve your problem!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.