0 Replies Latest reply on Dec 9, 2005 5:38 AM by nielsc

    ManagedConnection [InUse/Available/Max]: Inuse exceeds Max

    nielsc Newbie

      We are using JBoss 3.2.3 running on Windows 2003 Server with MSSQL as our database.

      We are persisting JMS queues to a MSSQL database.

      The mssql-ds.xml file is below


      <local-tx-datasource>
      <jndi-name>MSSQLDS</jndi-name>
      <connection-url>jdbc:jtds:sqlserver://artichoke:1433;databasename=casl</connection-url>
      <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
      <user-name>xxxxx</user-name>
      xxxxx

      <!-- sql to call when connection is created -->
      <new-connection-sql>SELECT 1 FROM CAS_USER</new-connection-sql>

      <!-- sql to call on an existing pooled connection when it is obtained from pool -->
      <check-valid-connection-sql>SELECT 1 FROM CAS_USER</check-valid-connection-sql>

      <min-pool-size>1</min-pool-size>
      <max-pool-size>100</max-pool-size>
      <blocking-timeout-millis>30000</blocking-timeout-millis>

      </local-tx-datasource>



      From the server.log file the number of InUse connection slowly grows, greatly exceeding the maximum connections limit.

      A connection may get used for about 2 hours. That is retrieved and replaced from the connection pool. After that period it seems that it is no longer used. Here are some snippets from the log file.

      2005-11-24 02:19:58,722 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] supplying new ManagedConnection: org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@1980932
      2005-11-24 02:19:58,722 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Getting connection from pool [InUse/Available/Max]: [2859/11/100]
      2005-11-24 02:19:58,738 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] putting ManagedConnection back into pool
      2005-11-24 02:19:58,738 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Returning connection to pool [InUse/Available/Max]: [2858/11/100]


      Then about 2.5 hours later

      2005-11-24 04:52:54,254 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] supplying ManagedConnection from pool: org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@1980932
      2005-11-24 04:52:54,254 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Getting connection from pool [InUse/Available/Max]: [3103/11/100]
      2005-11-24 04:52:54,254 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] putting ManagedConnection back into pool
      2005-11-24 04:52:54,254 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Returning connection to pool [InUse/Available/Max]: [3102/11/100]


      So from these two snippets it can be seen that the InUse count has increased significantly.
      The connection LocalManagedConnection@1980932 is not used after this. This may be correct in that it has been cleaned up from the pool as it has been used a certain number of times.

      What worries me is the increasing InUse count.

      Finally an OutOfMemory exception is thrown

      2005-11-24 07:16:43,425 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Returning connection to pool [InUse/Available/Max]: [4/3/20]
      2005-11-24 07:16:43,440 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.util.Collection com.beatSystems.mobaq.core.bean.localInterfaces.UploadServiceLocal.handle(com.beatSystems.soapMessage.dataModel.UserInfo,com.beatSystems.soapMessage.dataModel.DataPayload), causedBy:
      javax.ejb.EJBException: Unexpected Error
      java.lang.OutOfMemoryError

      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:182)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
      at $Proxy50.handle(Unknown Source)



      The application server is being used fairly lightly and it may take a couple of days to reach this point.

      The InUse count exceeding the Max connections used causes me concern. Is this just a red herring and the InUse count is wrong or are there actually 3000 odd connections in use. Even if there aren't 3000 connections in use could this be the cause of the memory (resource) leak?

      Note that the other two connection pools we use don't excced their Max limit of 20. The JMS connection pool Max limit is a 100.

      Cheers,
      Niels