-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Low
-
Affects Version/s: None
-
Component/s: None
The createAdditionalDatabaseIndexes method leaks database connections. It creates a connection using the following code:
conn = ConnectionProviderFactory.newConnectionProvider(hibernateConfig.getProperties()).getConnection();
It then closes that connection in a finally statement. However, the connection is a pooled connection, because it has been instantiated from the connection provider factory, which in this instance will be a C3P0 connection provider, and so closing the connection does nothing but put it back into the connection pool. The connection pool meanwhile is never closed, so the connection stays opened. What should happen is a reference to the ConnectionProvider should be kept, and in the finally statement, ConnectionProvider.close() should be called.