Uploaded image for project: 'IronJacamar'
  1. IronJacamar
  2. JBJCA-1403

Make connection Validation (at ConnectionValidator) outside of lock

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • None
    • None

      As can be seen in the following stack trace, connection validation inside the connection validator lock might lock the entire prefill of other pools:

      "default task-1122" #4743 prio=5 os_prio=0 tid=0x000000000929f800 nid=0x12067 waiting for monitor entry [0x00007fe6c7305000]
         java.lang.Thread.State: BLOCKED (on object monitor)
              at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getManagedConnectionPool(AbstractPool.java:299)
              - waiting to lock <0x0000000083be8028> (a org.jboss.jca.core.connectionmanager.pool.strategy.PoolBySubject)
              at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:596)
              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
              at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:440)
              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
              at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:151)
              at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
              ...
      "default task-1144" #4839 prio=5 os_prio=0 tid=0x000000000ccca800 nid=0x12718 waiting on condition [0x00007fe6cc532000]
         java.lang.Thread.State: WAITING (parking)
              at sun.misc.Unsafe.park(Native Method)
              - parking to wait for  <0x000000008082b8f8> (a java.util.concurrent.locks.ReentrantLock$FairSync)
              at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
              at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
              at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
              at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
              at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:224)
              at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
              at org.jboss.jca.core.connectionmanager.pool.validator.ConnectionValidator.internalRegisterPool(ConnectionValidator.java:185)
              at org.jboss.jca.core.connectionmanager.pool.validator.ConnectionValidator.registerPool(ConnectionValidator.java:167)
              at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.initialize(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:196)
              at org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPoolFactory.init(ManagedConnectionPoolFactory.java:191)
              at org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPoolFactory.create(ManagedConnectionPoolFactory.java:173)
              at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getManagedConnectionPool(AbstractPool.java:306)
              - locked <0x0000000083be8028> (a org.jboss.jca.core.connectionmanager.pool.strategy.PoolBySubject)
              at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:596)
              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
              at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:440)
              at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
              at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:151)
              at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
      

      The reason for this is that a new pool must be registered, and currently this operation is being blocked by connection validation. If connection validation is slow, this could compromise other threads creating pools and connections as shown in the example.

              flaviarnn Flavia Rainone
              flaviarnn Flavia Rainone
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: