Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-610

DB connection leak when using XA auto-enlist feature

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • M1
    • fuse-esb-7.1.0
    • None
    • None
    • % %

      If bundle exports a service which implements javax.sql.XADataSource, then Fuse ESB, according to auto-enlistment feature [1], is supposed to pick up this service
      and re-export a proxy data source service implementing javax.sql.DataSource interface. This new proxy service is responsible for auto-enlistment of XA connections
      into global transaction context. Applications should obtain connections from javax.sql.DataSource service. Then, upon connection closure and transaction completion, the proxy should return connection back to the pool. Unfortunately, it does not happen so connection pool is exhausted after some time.

      Reproducer is attached:
      1.) Service method which inserts one row into one-column table
      2.) Method is called in the transaction context which is confgigured in blueprint.xml by <tx:transaction> element
      3.) Connections are taken from pool of max size=20 (Tomcat XA pool is used), DB underneath is Oracle
      4.) Service method is called from client bundle 21 times
      5.) The last service call stucks and then exception is thrown

      Caused by: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [pool-org.sample.osgi-test-client-0.0.1.SNAPSHOT-thread-1] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:20; busy:20; idle:0; lastwait:30000].
      at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:672)
      at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:187)
      at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
      at org.apache.tomcat.jdbc.pool.DataSourceProxy.getXAConnection(DataSourceProxy.java:146)
      at org.apache.aries.transaction.jdbc.internal.XADatasourceEnlistingWrapper.getConnection(XADatasourceEnlistingWrapper.java:67)
      at org.sample.osgi.test.server.TestOSGIServiceImpl.sayHello2(TestOSGIServiceImpl.java:104)

      Note: Problem cannot be attributed to the parcticular pool implementatio being used. If, instead of Tomcat pool, we would use e.g. oracle.jdbc.xa.client.OracleXADataSource, the problem still stands.

      [1] https://access.redhat.com/knowledge/docs/en-US/Fuse_ESB_Enterprise/7.1/html-single/EIP_Transaction_Guide/index.html#XaJdbc-AutoEnlist

              g_nodet Guillaume Nodet (Inactive)
              amatusev_jira Andrew Matusevich (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: