title: c3p0 hangs in awaitAvailable with hibernate
body: <p>I have console application that hangs during execution. Here is my configuration:</p>
  
  <pre><code>    cfg.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
      cfg.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/db?user=db&amp;password=db");
      cfg.setProperty("hibernate.connection.username", "db");
      cfg.setProperty("hibernate.connection.password", "db");
      cfg.setProperty("hibernate.connection.pool_size", "5");
      cfg.setProperty("hibernate.connection.autocommit", "false");
      cfg.setProperty("hibernate.c3p0.min_size", "5");
      cfg.setProperty("hibernate.c3p0.max_size", "20");
      cfg.setProperty("hibernate.c3p0.timeout", "300");
      cfg.setProperty("hibernate.c3p0.max_statements", "50");
      cfg.setProperty("hibernate.c3p0.idle_test_period", "3000");
  </code></pre>
  
  <p>Here is my stacktrace:</p>
  
  <pre><code>"main" prio=10 tid=0x000000000168f800 nid=0x1c37 in Object.wait() [0x00007fa60d0ad000]
     java.lang.Thread.State: WAITING (on object monitor)
          at java.lang.Object.wait(Native Method)
          - waiting on &lt;0x00000007400f4c68&gt; (a com.mchange.v2.resourcepool.BasicResourcePool)
          at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1315)
          at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
          - locked &lt;0x00000007400f4c68&gt; (a com.mchange.v2.resourcepool.BasicResourcePool)
          at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
          at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
          at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
          at org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:84)
          at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:281)
          at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
          at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
          at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
          at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
          at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1392)
          at org.kriyak.parser.IndexArchiveRapid.indexFile(IndexArchiveRapid.java:70)
          at org.kriyak.parser.IndexArchiveRapid.main(IndexArchiveRapid.java:53)
  </code></pre>
  
  <p>I open only one conencton and it doesn't seem that I leak them. And also I use one thread. I haven't adjusted any mysql settings except memory usage. Mysql works fine from console. Why can this happen? Is this c3p0 error?</p>