Connection pool locked using Spring Dbcp2 pool

124 Views Asked by At

I have and application that manages hundreds of databases and I use a connection pool for every database. Sometimes one of the databases becomes locked and all the operations that involves queries on that connection pool are locked. It is very unusual but happens. I'm using MariaDb, Tomcat and Spring framework. The memory dump of the server when that happens shows me the problem but I don't understand what causes that. Only the pool that is locking is a GC Root for the garbage collector. Anyone has a clue of what can cause this? Thanks

I made a memory dump and I found this:

org.springframework.jdbc.core.JdbcTemplate$$Lambda$2684#4 [GC root - Java frame]  
org.springframework.jdbc.core.JdbcTemplate#142 [GC root - Java frame]
dataSource = org.apache.commons.dbcp2.BasicDataSource#143 [GC root - Java frame]
dataSource = org.apache.commons.dbcp2.PoolingDataSource#142 [GC root - Java frame]
dataSource in org.springframework.jdbc.datasource.DataSourceTransactionManager#142 [GC root - Java frame]
connectionPool = org.apache.commons.pool2.impl.GenericObjectPool#147 [GC root - Java frame]
idleObjects = org.apache.commons.pool2.impl.LinkedBlockingDeque#147 [GC root - Java frame]
0

There are 0 best solutions below