1 Reply Latest reply on Feb 3, 2013 4:58 AM by Edoardo Schepis

    Acquisition Attempt Failed: Too many connections

    Edoardo Schepis Newbie


      working with Infinispan 5.1.6 FINAL, on JBoss AS 7.1, I have 3 caches and I'm using MySQL 5.1 as cachestore. (see attached the infinispan.xml).

      After some time (not sure about the root cause) I see the following errors (see attached server.log):


      2013/02/02 11:48:42,925 WARN  [com.mchange.v2.resourcepool.BasicResourcePool] (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@162029c -- 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 (30). Last acquisition attempt exception: : com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"


      2013/02/02 11:49:00,175 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[org.openvoters.servlet.RankingServlet]] (http- Servlet.service() for servlet org.openvoters.servlet.RankingServlet threw exception: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.loaders.CacheLoaderManagerImpl.start() on object of type CacheLoaderManagerImpl


      When I restart the server everything is ok again.


      Thanks in advancd for your help


        • 1. Re: Acquisition Attempt Failed: Too many connections
          Edoardo Schepis Newbie

          After more investigation I think that the issue could be related to the following code:

          EmbeddedCacheManager manager = new DefaultCacheManager("infinispan.xml");

          Cache<String, String> cache = manager.getCache("list");

          I'm using it to collect all the entries (values) of a cache and then order them.

          The issue I think is that I invoke these two lines every time, and in the logs I have the following:

          Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource

          So for each manager instance I have a new c3p0 pool, and maybe at the end I'm going to consume all the connection to the DB (Hibernate).


          So now I've created a singleton to have just one manager and one cache in memory and therefore just one pool.


          I'll keep you updated on this, but if you have some thoughts or suggestions to share I'll appreciate it.