title: Large latency when thread interrupted using hibernate and c3p0
body: <p>I am seeing these warnings in our logs, and when I do, I see larger-than-normal latencies on transactions in our database. I've scoured the internet looking for more information.</p>
  
  <pre><code>2014-12-01 18:14:03,866 [BoundedFuturePool-2] WARN  com.mchange.v2.resourcepool.BasicResourcePool  - {} com.mchange.v2.resourcepool.BasicResourcePool@2f18b0cb -- an attempt to checkout a resource was interrupted, and the pool is still live: some other thread must have either interrupted the Thread attempting checkout!
  java.lang.InterruptedException
  at java.lang.Object.wait(Native Method)
  at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1414)
  at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606)
  at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526)
  at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:755)
  at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:682)
  at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
  at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
  at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
  at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
  at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:74)
  at com.sun.proxy.$Proxy40.setReadOnly(Unknown Source)
  at org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction(DataSourceUtils.java:155)
  at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:508)
  at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
  at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:329)
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
  at com.twitter.amplify.videoediting.data.TranscodingDao$$EnhancerByCGLIB$$696749fa.getTranscodeInfo(&lt;generated&gt;)
  at com.twitter.amplify.videoediting.GetTranscodeInfoHandler$$anonfun$7.apply(GetTranscodeInfoHandler.scala:78)
  at com.twitter.amplify.videoediting.GetTranscodeInfoHandler$$anonfun$7.apply(GetTranscodeInfoHandler.scala:78)
  at com.twitter.util.Try$.apply(Try.scala:13)
  at com.twitter.util.ExecutorServiceFuturePool$$anon$2.run(FuturePool.scala:112)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at com.twitter.amplify.util.LocalExecutorService$1.call(LocalExecutorService.java:36)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Below is our configuration object.</p>
  
  <pre><code>Using DataSource [com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -&gt; 5, acquireRetryAttempts -&gt; 30, acquireRetryDelay -&gt; 1000, autoCommitOnClose -&gt; false, automaticTestTable -&gt; null, breakAfterAcquireFailure -&gt; false, checkoutTimeout -&gt; 0, connectionCustomizerClassName -&gt; null, connectionTesterClassName -&gt; com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -&gt; 2u120u951sgpypjpvvovo|73f2f11, debugUnreturnedConnectionStackTraces -&gt; false, description -&gt; null, driverClass -&gt; com.mysql.jdbc.Driver, factoryClassLocation -&gt; null, forceIgnoreUnresolvedTransactions -&gt; false, identityToken -&gt; 2u120u951sgpypjpvvovo|73f2f11, idleConnectionTestPeriod -&gt; 0, initialPoolSize -&gt; 0, jdbcUrl -&gt; jdbc:mysql://db-hat-rw-master-001.global-db.twttr.net/amplify?defaultFetchSize=200, maxAdministrativeTaskTime -&gt; 0, maxConnectionAge -&gt; 0, maxIdleTime -&gt; 60, maxIdleTimeExcessConnections -&gt; 60, maxPoolSize -&gt; 200, maxStatements -&gt; 0, maxStatementsPerConnection -&gt; 0, minPoolSize -&gt; 0, numHelperThreads -&gt; 3, preferredTestQuery -&gt; select 1, properties -&gt; {user=******, password=******}, propertyCycle -&gt; 0, statementCacheNumDeferredCloseThreads -&gt; 0, testConnectionOnCheckin -&gt; false, testConnectionOnCheckout -&gt; true, unreturnedConnectionTimeout -&gt; 300, userOverrides -&gt; {}, usesTraditionalReflectiveProxies -&gt; false ]]
  </code></pre>
  
  <p>Thank you for your help!
  Max</p>