After long time running. My database connection exhausted. From the MBeans I can see many closed connections, and the in_pool connections is equals (db_allowed_max_conns - mark_as_closed_conns).
And I found some exceptions in my moqui.log file.
--- 2021-08-14 06:53:37.625 [oquiScheduled-2] WARN bitronix.tm.resource.common.XAPool []
error closing a JdbcPooledConnection from datasource transactional_DS in state CLOSED with usage count 0 wrapping org.postgresql.xa.PGXAConnection@2287aa1
java.util.ConcurrentModificationException: null
at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719) ~[?:1.8.0_265]
at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:752) ~[?:1.8.0_265]
at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:750) ~[?:1.8.0_265]
at bitronix.tm.resource.jdbc.LruStatementCache.clear(LruStatementCache.java:171) ~[moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at bitronix.tm.resource.jdbc.JdbcPooledConnection.close(JdbcPooledConnection.java:150) ~[moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at bitronix.tm.resource.common.XAPool.expireStatefulHolder(XAPool.java:534) [moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at bitronix.tm.resource.common.XAPool.getInPool(XAPool.java:320) [moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:181) [moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:150) [moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at bitronix.tm.resource.jdbc.PoolingDataSource.getConnection(PoolingDataSource.java:277) [moqui_temp3453359234312533122WEB-INF_lib_btm-3.0.0-SNAPSHOT.jar.:3.0.0-SNAPSHOT]
at org.moqui.impl.entity.EntityFacadeImpl.getConnection(EntityFacadeImpl.groovy:2031) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at org.moqui.impl.entity.EntityQueryBuilder.makeConnection(EntityQueryBuilder.java:66) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at org.moqui.impl.entity.EntityFindImpl.oneExtended(EntityFindImpl.java:78) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at org.moqui.impl.entity.EntityFindBase.oneInternal(EntityFindBase.groovy:941) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at org.moqui.impl.entity.EntityFindBase.one(EntityFindBase.groovy:720) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at org.moqui.impl.service.ScheduledJobRunner.runInternal(ScheduledJobRunner.groovy:136) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at org.moqui.impl.service.ScheduledJobRunner.run(ScheduledJobRunner.groovy:74) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_265]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_265]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_265]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_265]
at org.moqui.impl.context.ContextJavaUtil$CustomScheduledTask.run(ContextJavaUtil.java:693) [moqui_temp7464524058079123453WEB-INF_lib_moqui-framework-3.0.0-rc8.jar.:3.0.0-rc8]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]
Don’t known what cause java.util.ConcurrentModificationException.