Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-15328

[GSS](7.2.z) JBJCA-1385 - EAP 7 / xa-datasource creates twice connections as much as max-pool-size

    Details

    • Target Release:
    • Steps to Reproduce:
      Hide

      1. Create xa-datasource, max-pool-size = 25, prefill = true, validate-on-match = true, statistics-enabled = true (statictics is for check ActiveCount)
      2. getConnection from the datasource by any application.
      3. shutting down the database. ( closeing all connections )
      4. getConnection from the datasource by any application.
      5. starting up the database. ( re-create connections by prefill )
      6. you can see the ActiveCount is 50. ( over the max-pool-size )
      or it can be seen by netstat to see the Established sockets to database from EAP.

      Show
      1. Create xa-datasource, max-pool-size = 25, prefill = true, validate-on-match = true, statistics-enabled = true (statictics is for check ActiveCount) 2. getConnection from the datasource by any application. 3. shutting down the database. ( closeing all connections ) 4. getConnection from the datasource by any application. 5. starting up the database. ( re-create connections by prefill ) 6. you can see the ActiveCount is 50. ( over the max-pool-size ) or it can be seen by netstat to see the Established sockets to database from EAP.
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Using SemaphoreArrayListManagedConnectionPool for xa-datasource.

      /subsystem=datasources/xa-data-source=<DATASOURCE>:write-attribute(name=mcp,value=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool)

      Show
      Using SemaphoreArrayListManagedConnectionPool for xa-datasource. /subsystem=datasources/xa-data-source=<DATASOURCE>:write-attribute(name=mcp,value=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool)

      Description

      After createing connections by prefill, xa-datasource can have connection much more than max-pool-size.
      Although prefill try to create connections based on `SemaphoreConcurrentLinkedDequeManagedConnectionPool.poolsize`, the poolsize count is broken after closing connections by test failure.

      `SemaphoreConcurrentLinkedDequeManagedConnectionPool#removeConnectionListenerFromPool() is called 2 times per a connection during closing them, so that the poolsize can be decreased much more than existed connections.
      When the poolsize is 25, it become -25 after closing all connections. And prefill try to create 50 connections until the poolsize count becomes 25 from -25.

      `removeConnectionListenerFromPool()` is called as the following stacktrace during closing 1 connection.

      1.

       org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.removeConnectionListenerFromPool(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:-1)
       org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:736)
       org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:611)
       org.jboss.jca.core.connectionmanager.pool.AbstractPool.returnConnection(AbstractPool.java:847)
       org.jboss.jca.core.connectionmanager.AbstractConnectionManager.returnManagedConnection(AbstractConnectionManager.java:725)
       org.jboss.jca.core.connectionmanager.listener.AbstractConnectionListener.connectionErrorOccurred(AbstractConnectionListener.java:472)
       org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.broadcastConnectionError(BaseWrapperManagedConnection.java:673)
       org.jboss.jca.adapters.jdbc.xa.XAManagedConnection.broadcastConnectionError(XAManagedConnection.java:203)
       org.jboss.jca.adapters.jdbc.xa.XAManagedConnection$1.connectionErrorOccurred(XAManagedConnection.java:91)
       org.postgresql.ds.PGPooledConnection.fireConnectionFatalError(PGPooledConnection.java:183)
       org.postgresql.ds.PGPooledConnection.fireConnectionError(PGPooledConnection.java:237)
       org.postgresql.ds.PGPooledConnection.access$200(PGPooledConnection.java:38)
       org.postgresql.ds.PGPooledConnection$StatementHandler.invoke(PGPooledConnection.java:428)
       com.sun.proxy.$Proxy55.execute (Unknown Source)
       org.jboss.jca.adapters.jdbc.CheckValidConnectionSQL.isValidConnection(CheckValidConnectionSQL.java:74)
       org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:1304)
       org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.getInvalidConnections(BaseWrapperManagedConnectionFactory.java:1086)
       org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:379)
       org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:632)
       org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:604)
       org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
       org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:430)
       org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
       org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
       org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
       ...
      

      2.

       org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.removeConnectionListenerFromPool(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:-1)
       org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:452)
       org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:632)
       org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:604)
       org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
       org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:430)
       org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
       org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
       org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
       ...
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  spyrkob Bartosz Spyrko-Smietanko
                  Reporter:
                  hiroki.daicho Hiroki Daicho
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: