Rider is leaking connections when cacheConnections = false
See original GitHub issueDBUnitExtension is leaking connections when the cacheConnections flag is false. If the are more than X tests and the connection pool has X connections the subsequent tests fails when waiting for checking out new connections.
The if the flag is set DataSetExecutorImpl.instance
method doesn’t set the connectionHolder
to the context which means that the beforeTestExecution
must close the connection, which it doesn’t.
if (instance == null) {
instance = new DataSetExecutorImpl(executorId, connectionHolder,
DBUnitConfig.fromGlobalConfig().executorId(executorId));
log.debug("creating executor instance " + executorId);
executors.put(executorId, instance);
} else if (!instance.dbUnitConfig.isCacheConnection()) {
instance.setConnectionHolder(connectionHolder);
}
Also, even the cached connection seems to be never closed.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Database Rider Documentation - GitHub Pages
Database connection leak detection . ... Detecting connection leak . ... @DBUnit(cacheConnection = true, cacheTableNames = false, allowEmptyFields =.
Read more >How to detect leaked datasource connections using the ...
How to detect leaked datasource connections using the cached connection manager (CCM) debug facility in JBoss EAP.
Read more >Database Rider Versions - Open Source Agenda
Release notes · Rider is leaking connections when cacheConnections = false (#332) · Warning is issued if column value contains : (Colon) (#335)...
Read more >DBUnit (rider-core 1.9.1 API) - Javadoc Extreme - Javadox
public abstract boolean cacheConnection ... Returns: if true will activate connection leak detection. Default: false ... Defaults to false. Default: false ...
Read more >Connecting to the Caché Database
This example defines the CacheConnection object as a global that can be used ... Set Pooling to false to create a connection with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @rmpestano. I think your exception is different from mine. My tests fails explicitly with a timeout exception when trying to checkout a connection, they all timeout after 30 seconds which is the timeout limit for Hikari connection checkout. I don’t think DBRider should manage any connection at all but return them when they are done with it. This to let the container run un-interfered since this will not happen in production. That’s why we were running with the connectionCached = false set.
Hi @hheg, I’ve added a test on junit5 module and indeed when
cacheConnection=false
it is failing after the first test is run. The second test will fail to retrieve information from the connection (probably because it is closed):Thanks for the heads up, I’ll investigate