Only single thread can create JDBC connection at once in JBoss EAP 5.2
Environment
- JBoss Enterprise Application Platform (EAP) 5.2.0
Issue
-
A threaddump shows that all request threads are blocked in an attempt to get a connection from the DB connection pool.
-
A single thread in a synchronized block is creating a database connection
... java.lang.Thread.State: RUNNABLE at oracle.jdbc.driver.T2CConnection.t2cCreateState(Native Method) at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:414) at oracle.jdbc.driver.PhysicalConnection. (PhysicalConnection.java:546) at oracle.jdbc.driver.T2CConnection. (T2CConnection.java:162) at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:207) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195) - locked <0x0000000782cd9730> (a org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:650) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:273) at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:689) at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404) at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:424) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:96) ... -
Many other threads are blocked waiting for access to the connection
... java.lang.Thread.State: BLOCKED (on object monitor) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171) - waiting to lock <0x0000000782cd9730> (a org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:650) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:273) at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:689) at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404) at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:424) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:96) ...
Resolution
Please raise a support case to discuss a fix.
Root Cause
- This is a known defect Content from issues.jboss.org is not included.JBPAPP-10968.
- Resolution for a deadlock vulnerability added synchronization which serialized attempts to create JDBC connections.
- The degree to which this issue impacts a system is dependent on the time taken by the database to create connections.
- Slow creation or hangs during database connection creation may result in noticeable slowdown for application threads.
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.