Connection Leak in ConfigurationInitializer (not critical, because one time)
----------------------------------------------------------------------------
Key: MIFOS-5097
URL: http://mifosforge.jira.com/browse/MIFOS-5097
Project: mifos
Issue Type: Bug
Reporter: Michael Vorburger
Priority: Major
Using MIFOS-5096, I've identified what appears to be a Connection Leak in
ConfigurationInitializer:
2011-07-23/23:55:47.346/IST INFO,
com.mchange.v2.resourcepool.BasicResourcePool, ?, ?, ?, A checked-out resource
is overdue, and will be destroyed:
com.mchange.v2.c3p0.impl.NewPooledConnection@1499616
2011-07-23/23:55:47.350/IST INFO,
com.mchange.v2.resourcepool.BasicResourcePool, ?, ?, ?, Logging the stack trace
by which the overdue resource was checked-out.
java.lang.Exception: DEBUG ONLY: Overdue resource check-out stack trace.
at
com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:506)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
at
com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
at
org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:78)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at
org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
at
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at
org.mifos.framework.persistence.LegacyGenericDao.executeNamedQuery(LegacyGenericDao.java:105)
at
org.mifos.config.persistence.ConfigurationPersistence.getCurrency(ConfigurationPersistence.java:55)
at
org.mifos.config.AccountingRules.getMifosCurrency(AccountingRules.java:93)
at
org.mifos.config.AccountingRules.getMifosCurrency(AccountingRules.java:89)
at
org.mifos.config.util.helpers.ConfigurationInitializer.createSystemConfiguration(ConfigurationInitializer.java:66)
at
org.mifos.config.util.helpers.ConfigurationInitializer.initialize(ConfigurationInitializer.java:113)
at
org.mifos.config.business.Configuration.initialize(Configuration.java:57)
at
org.mifos.config.business.Configuration.getInstance(Configuration.java:50)
at
org.mifos.framework.ApplicationInitializer.setAttributesOnContext(ApplicationInitializer.java:352)
at
org.mifos.framework.ApplicationInitializer.init(ApplicationInitializer.java:206)
at
org.mifos.framework.ApplicationInitializer.contextInitialized(ApplicationInitializer.java:150)
at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:645)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:229)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1158)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:588)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:436)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:258)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.mifos.server.AbstractServerLauncher.startServer(AbstractServerLauncher.java:67)
at
org.mifos.server.workspace.WorkspaceServerLauncherMain.main(WorkspaceServerLauncherMain.java:39)
This appears without doing anything in particular (if you have the MIFOS-5096
c3p0.properties on the CP), just start-up, and wait a bit (don't even have to
log in).
It appears to me ConfigurationInitializer uses AccountingRules.getMifosCurrency
which uses Hibernate but the underlying Connection is never closed?
I've tried fixing this by simply adding a StaticHibernateUtil.closeSession();
as the last statement in ApplicationInitializer's dbUpgrade(), but that didn't
help - somebody (may be not be) would have to dig deeper into this.
As far as I undestand this specific Connection Leak, while always bad, is not
critical/blocker, because it will leak exactly one connection during start-up -
not an ever increasing pile of connectionS in function and as a result of end
user load.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide. Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues