3 Replies Latest reply on Sep 28, 2013 11:10 PM by xiang yingbing

    why the db connections in jboss7.1 datasource pool were increasing all time and Jboss crashed at last??

    rtskoo rtskoo Newbie

      I found in jboss-app-console that the connection in db pool were increasing until to the max value and jboss was not able to conection to database finally .what is the problem,please??(There were 100+ clients who connected to the server and about 100-200 TCP connections as result).

      (1) I got lot of trace info  in log file like this about the db pool :

      [10:49:06,097] TRACE [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (http--0.0.0.0-80-11) connectionClosed called mc=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@7ae7b3a7

      [10:49:06,098] TRACE [org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager] (http--0.0.0.0-80-11) unregistering connection from connection manager: org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl@15881ebc, connection: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@3c145831, key: null

      [10:49:06,098] TRACE [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (http--0.0.0.0-80-11) unregisterConnection: 0 handles left

      [10:49:06,098] TRACE [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (http--0.0.0.0-80-11) isManagedConnectionFree=false mc=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@7ae7b3a7

      [10:49:06,102] TRACE [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (http--0.0.0.0-80-11) afterCompletion(3) isTrackByTx=true for org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@506c5f58[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@7ae7b3a7 connection handles=0 lastUse=1372301316857 trackByTx=true pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@337b6361 pool internal context=SemaphoreArrayListManagedConnectionPool@1a178ca0[pool=OraEfrDS] xaResource=LocalXAResourceImpl@1c3d7fb[connectionListener=506c5f58 connectionManager=15881ebc warned=false currentXid=null] txSync=null]

      [10:49:06,103] TRACE [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http--0.0.0.0-80-11) ManagedConnectionPool: 1a178ca0

      Method: returnConnection(506c5f58, false)

      ManagedConnectionFactory:

        Class: org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory

        Object: 1017bad0

      ConnectionListenerFactory:

        Class: org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl

        Object: 15881ebc

      Pool:

        Name: OraEfrDS

      PoolConfiguration:

        MinSize: 3

        MaxSize: 60

        BlockingTimeout: 120000

        IdleTimeoutMinutes: 3

        BackgroundValidation: false

        BackgroundValidationMillis: 0

        StrictMin: false

        UseFastFail: false

      Available:

        72d43ffa (NORMAL)

        6d8b8ed1 (NORMAL)

      InUse:

        506c5f58 (NORMAL)

      Statistics:

        ActiveCount: 3

        AvailableCount: 59

        AverageBlockingTime: 0

        AverageCreationTime: 40

        CreatedCount: 528

        DestroyedCount: 525

        MaxCreationTime: 212

        MaxUsedCount: 2

        MaxWaitCount: 0

        MaxWaitTime: 1

        TimedOut: 525

        TotalBlockingTime: 6

        TotalCreationTime: 21197

      [10:49:06,105] TRACE [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (http--0.0.0.0-80-11) Returning connection to pool org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@506c5f58[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@7ae7b3a7 connection handles=0 lastUse=1372301346105 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@337b6361 pool internal context=SemaphoreArrayListManagedConnectionPool@1a178ca0[pool=OraEfrDS] xaResource=LocalXAResourceImpl@1c3d7fb[connectionListener=506c5f58 connectionManager=15881ebc warned=false currentXid=null] txSync=null] .

       

      (2) My datasource pool is configured in jboss7.1 as follow:


      <subsystem xmlns="urn:jboss:domain:datasources:1.0">

      <datasources>

      <datasource jta="true" jndi-name="java:jboss/datasources/OraEfrDS" pool-name="OraEfrDS" enabled="true" use-java-context="true" spy="true" use-ccm="true">

      <connection-url>jdbc:oracle:thin:@127.0.0.1:1521:aa</connection-url>

      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

      <driver>oracle</driver>

      <new-connection-sql>call DBMS_APPLICATION_INFO.SET_MODULE('MyApp','java:jboss/datasources/OraEfrDS')</new-connection-sql>

      <pool>

      <min-pool-size>10</min-pool-size>

      <max-pool-size>500</max-pool-size>

      <prefill>true</prefill>

      <use-strict-min>false</use-strict-min>

      <flush-strategy>FailingConnectionOnly</flush-strategy>

      </pool>

      <security>

      <user-name>test</user-name>

      <password>test</password>

      </security>

      <validation>

      <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>

      <validate-on-match>false</validate-on-match>

      <background-validation>false</background-validation>

      <use-fast-fail>false</use-fast-fail>

      <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>

      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>

      </validation>

      <timeout>

      <blocking-timeout-millis>120000</blocking-timeout-millis>

      <idle-timeout-minutes>1</idle-timeout-minutes>

      </timeout>

      <statement>

      <prepared-statement-cache-size>100</prepared-statement-cache-size>

      </statement>

      </datasource>
        • 2. Re: Re: why the db connection in jboss7.1 datasource pool is increasing all time and crash at last?
          Eric Manuguerra Newbie

          Hi,

           

          I face a similar issue. We have just migrated production front servers from AS 5.1 GA to AS 7.1.1.Final.

           

          We had no connection leak in AS 5, but now the pool is getting saturated with unreleased connections after 4 to 5 hour of use. We have  a Spring / Hibernate application deployed in JBoss. There is no manual opening / closing of connections.

           

          Here is the configuration :

           

          <bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="dataSource" ref="dataSource" />
            <property name="configLocation" value="classpath:hibernate.cfg.xml" />
            <!-- [MULTITENANT] -->
            <property name="entityInterceptor" ref="tenantInterceptor" />
            <property name="hibernateProperties">
            <props>
            <prop key="hibernate.dialect">com.itesoft.share.model.MySQL5DialectExt</prop>
            <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</prop>
            <prop key="hibernate.cache.use_second_level_cache">${use.l2.cache}</prop>
            <prop key="hibernate.cache.use_query_cache">false</prop>
            <prop key="hibernate.cache.provider_configuration_file_resource_path">${model.cache.config}</prop>
            <prop key="hibernate.cache.region_prefix">${cache.subfolder}</prop>
            <prop key="hibernate.connection.useUnicode">true</prop>
            <prop key="hibernate.connection.characterEncoding">utf-8</prop>
            <!-- prop key="hibernate.hbm2ddl.auto">validate</prop -->
            <prop key="hibernate.show_sql">${show.sql}</prop>
            <!-- [MULTITENANT] Needed for multitenant support -->
            <prop key="hibernate.default_catalog">TO_BE_DETERMINED_DB</prop>
          
            <!-- Location is filtered by Maven build-->
            <prop key="hibernate.search.default.indexBase">${ftindex.location.root}/${datasource.database}/${ftindex.folder}</prop>
            <prop key="hibernate.search.analyzer">custom_analyzer</prop>
            <prop key="hibernate.search.worker.backend">lucene</prop>
            <prop key="org.hibernate.worker.execution">async</prop>
            <prop key="hibernate.search.worker.execution">async</prop>
            </props>
            </property>
            <!-- Manually set Hibernate Search event listeners -->
            <property name="eventListeners">
            <map>
            <entry key="post-update" value-ref="indexListener">
            </entry>
            <entry key="post-insert" value-ref="indexListener">
            </entry>
            <entry key="post-delete" value-ref="indexListener">
            </entry>
            <entry key="post-collection-recreate" value-ref="indexListener">
            </entry>
            <entry key="post-collection-remove" value-ref="indexListener">
            </entry>
            <entry key="post-collection-update" value-ref="indexListener">
            </entry>
            </map>
            </property>
            </bean>
          

           

          I have activated the Cached connection manager trace. There are only 2 occurences of leaks (when the application starts just after server) in the logs but several hundred of pending connections appearing in the pool statistics, even after several hours of server inactivity. I thought idle connections would have been closed automatically.

           

          Anyway we can't upgrade quickly to Wildfly 8. We have just migrated and tested our application on AS 7.

           

          Do you have any other suggestion ? An Iron Jacamar module upgrade would fix it ? How can we fix the leaks ?

           

          Thanks for your help,

          Eric

          • 3. Re: why the db connections in jboss7.1 datasource pool were increasing all time and Jboss crashed at last??
            xiang yingbing Master

            I am sure there are something wrong with your code instead of jboss as.

            I have used jboss as 7 two years. It works well.

             

            I think you had better use jboss as 7.2.0 instead of jboss as 7.1.

            jboss as 7.2.0 fixed many many bugs exiting in jboss as 7.1.