Describe the bug
The Atomikos background thread periodically destroys connections that have exceeded their maximum lifetime. If another thread frequently accesses the database to create connections, it will encounter a null pointer error when creating the thread.
To Reproduce
Steps to reproduce the behavior:
- set MinPoolSize = 1 and MaxPoolSize=2 MaxLifeTime=3,ReapTimeOut=0。env:SpringBoot3+JDK17+Atomikos+Druid+@SchedulerLock+Mysql
- I encountered a null pointer exception, with the error message: “Cannot invoke ‘Object.getClass()’ because ‘c’ is null.”
- This exception should not occur in a multithreaded environment.
- I Use transactions-spring-boot-starter,version is 5.0.9
Additional context
Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "c" is null
at com.atomikos.jdbc.AtomikosConnectionProxy.newInstance(AtomikosConnectionProxy.java:246)
at com.atomikos.jdbc.AtomikosXAPooledConnection.doCreateConnectionProxy(AtomikosXAPooledConnection.java:93)
at com.atomikos.datasource.pool.AbstractXPooledConnection.createConnectionProxy(AbstractXPooledConnection.java:56)
at com.atomikos.datasource.pool.ConnectionPoolWithConcurrentValidation.concurrentlyTryToUse(ConnectionPoolWithConcurrentValidation.java:59)
at com.atomikos.datasource.pool.ConnectionPoolWithConcurrentValidation.retrieveFirstAvailableConnection(ConnectionPoolWithConcurrentValidation.java:41)
at com.atomikos.datasource.pool.ConnectionPool.retrieveFirstAvailableConnectionAndGrowPoolIfNecessary(ConnectionPool.java:153)
at com.atomikos.datasource.pool.ConnectionPool.findOrWaitForAnAvailableConnection(ConnectionPool.java:141)
at com.atomikos.datasource.pool.ConnectionPool.borrowConnection(ConnectionPool.java:132)
at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:346)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:269)
... 31 common frames omitted
Describe the bug
The Atomikos background thread periodically destroys connections that have exceeded their maximum lifetime. If another thread frequently accesses the database to create connections, it will encounter a null pointer error when creating the thread.
To Reproduce
Steps to reproduce the behavior:
Additional context
Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "c" is null
at com.atomikos.jdbc.AtomikosConnectionProxy.newInstance(AtomikosConnectionProxy.java:246)
at com.atomikos.jdbc.AtomikosXAPooledConnection.doCreateConnectionProxy(AtomikosXAPooledConnection.java:93)
at com.atomikos.datasource.pool.AbstractXPooledConnection.createConnectionProxy(AbstractXPooledConnection.java:56)
at com.atomikos.datasource.pool.ConnectionPoolWithConcurrentValidation.concurrentlyTryToUse(ConnectionPoolWithConcurrentValidation.java:59)
at com.atomikos.datasource.pool.ConnectionPoolWithConcurrentValidation.retrieveFirstAvailableConnection(ConnectionPoolWithConcurrentValidation.java:41)
at com.atomikos.datasource.pool.ConnectionPool.retrieveFirstAvailableConnectionAndGrowPoolIfNecessary(ConnectionPool.java:153)
at com.atomikos.datasource.pool.ConnectionPool.findOrWaitForAnAvailableConnection(ConnectionPool.java:141)
at com.atomikos.datasource.pool.ConnectionPool.borrowConnection(ConnectionPool.java:132)
at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:346)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:269)
... 31 common frames omitted