title: c3p0 A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool
body: <p>I have a java application deployed on tomcat version 7. For the data source I used c3p0 which connects to a mysql database.
  It was working fine for years and recently I started to get this error : 
  "A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool".</p>
  
  <p>When I have this issue the only solution is restarting the application. Restarting mysql doesn't help. </p>
  
  <p>I have also php applications using the save database and they are not affected, they work properly.</p>
  
  <p>I java application is used only by a small team, it's a backend application.</p>
  
  <p>Here is my c3p0 configuration :</p>
  
  <pre><code>&lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt;
    &lt;property name="driverClass" value="com.mysql.jdbc.Driver" /&gt;
    &lt;property name="jdbcUrl" value="jdbc:mysql://localhost:3306/db?relaxAutoCommit=true&amp;amp;autoReconnect=true&amp;amp;autoReconnectForPools=true" /&gt;
    &lt;property name="user" value="viva4578" /&gt;
    &lt;property name="password" value="amd139fbg" /&gt;
    &lt;property name="initialPoolSize" value="5" /&gt;
    &lt;property name="minPoolSize" value="5" /&gt;
    &lt;property name="maxPoolSize" value="20" /&gt;
    &lt;property name="maxConnectionAge" value="14400" /&gt;
    &lt;property name="checkoutTimeout" value="30000" /&gt;
    &lt;property name="acquireIncrement" value="1" /&gt;
    &lt;property name="acquireRetryAttempts" value="30" /&gt;
    &lt;property name="testConnectionOnCheckin" value="true" /&gt;
    &lt;property name="testConnectionOnCheckout" value="true" /&gt;
    &lt;property name="preferredTestQuery" value="SELECT 1" /&gt;
    &lt;property name="idleConnectionTestPeriod" value="3600" /&gt;
    &lt;property name="maxIdleTime" value="7200" /&gt;
    &lt;property name="maxIdleTimeExcessConnections" value="1800" /&gt;
    &lt;property name="unreturnedConnectionTimeout" value="3600" /&gt;
    &lt;property name="debugUnreturnedConnectionStackTraces" value="true" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Here is the output log of c3p0 after starting the application :</p>
  
  <pre><code>Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ 
    acquireIncrement -&gt; 1,
    acquireRetryAttempts -&gt; 30,
    acquireRetryDelay -&gt; 1000,
    autoCommitOnClose -&gt; false,
    userOverrides -&gt; {},
    automaticTestTable -&gt; null,
    breakAfterAcquireFailure -&gt; false,
    checkoutTimeout -&gt; 30000,
    connectionCustomizerClassName -&gt; null,
    connectionTesterClassName -&gt; com.mchange.v2.c3p0.impl.DefaultConnectionTester,
    contextClassLoaderSource -&gt; caller,
    dataSourceName -&gt; z8kflt9n1b12nsh118544e|7bc1a68b,
    debugUnreturnedConnectionStackTraces -&gt; true,
    description -&gt; null,
    driverClass -&gt; com.mysql.jdbc.Driver,
    extensions -&gt; {},
    factoryClassLocation -&gt; null,
    forceIgnoreUnresolvedTransactions -&gt; false,
    forceUseNamedDriverClass -&gt; false,
    identityToken -&gt; z8kflt9n1b12nsh118544e|7bc1a68b,
    idleConnectionTestPeriod -&gt; 3600,
    initialPoolSize -&gt; 5,
    jdbcUrl -&gt; jdbc:mysql://localhost:3306/db?relaxAutoCommit=true&amp;autoReconnect=true&amp;autoReconnectForPools=true,
    maxAdministrativeTaskTime -&gt; 0,
    maxConnectionAge -&gt; 14400,
    maxIdleTime -&gt; 7200,
    maxIdleTimeExcessConnections -&gt; 1800,
    maxPoolSize -&gt; 20,
    maxStatements -&gt; 0,
    maxStatementsPerConnection -&gt; 0,
    minPoolSize -&gt; 5,
    numHelperThreads -&gt; 3,
    preferredTestQuery -&gt; SELECT 1,
    privilegeSpawnedThreads -&gt; false,
    properties -&gt; {user=******, password=******},
    propertyCycle -&gt; 0,
    statementCacheNumDeferredCloseThreads -&gt; 0,
    testConnectionOnCheckin -&gt; true,
    testConnectionOnCheckout -&gt; true,
    unreturnedConnectionTimeout -&gt; 3600,
    usesTraditionalReflectiveProxies -&gt; false
  ]
  </code></pre>
  
  <p>I am using the version 0-0.9.5 of c3p0.</p>
  
  <p>If someone can help</p>
  
  <p>Thank you</p>