Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333251 - Connection leak while using weblogic connection pool
Summary: Connection leak while using weblogic connection pool
Status: CLOSED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.5.1   Edit
Hardware: All Linux
: P3 trivial (vote)
Target Milestone: 3.7.0   Edit
Assignee: Birt-DataAccess CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-27 15:22 EST by TedMalaska CLA
Modified: 2011-05-26 13:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description TedMalaska CLA 2010-12-27 15:22:35 EST
Build Identifier: 2.6.1

Somewhere is BIRT connections are being opened and not closed.  When I connect to the database directly (host:sid:username:password) I have no problems, but when I use a connection pool then all the connection get used up.  

Now from reading old bug report I noted that some of the development is happen in Jboss with a config that allows Jboss to close unclosed conenctions.  Please turn that config off when testing this bug.  In fact never turn that config on, it only creates bad code.

<Dec 27, 2010 3:19:14 PM EST> <Warning> <JDBC> <BEA-001153> <Forcibly releasing inactive connection "weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@8fb8" back into the connection pool
"SCRCDataSource", currently reserved by: java.lang.Exception
        at weblogic.jdbc.common.internal.ConnectionEnv.setup(ConnectionEnv.java:308)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:314)
        at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:292)
        at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:425)
        at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:316)
        at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:93)
        at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:106)
        at weblogic.jdbc.pool.Driver.connect(Driver.java:149)
        at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:642)
        at weblogic.jdbc.jts.Driver.connect(Driver.java:124)
        at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:338)
        at org.eclipse.birt.report.data.oda.jdbc.JndiDataSource.getDataSourceConnection(JndiDataSource.java:178)
        at org.eclipse.birt.report.data.oda.jdbc.JndiDataSource.getConnection(JndiDataSource.java:133)
        at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.getJndiDSConnection(JDBCDriverManager.java:325)
        at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.doConnect(JDBCDriverManager.java:225)
        at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.getConnection(JDBCDriverManager.java:212)
        at org.eclipse.birt.report.data.oda.jdbc.Connection.connectByUrl(Connection.java:234)
        at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java:160)
        at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:239)
        at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:165)
        at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSource.java:190)
        at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java:178)
        at org.eclipse.birt.data.engine.impl.DataSourceRuntime.openOdiDataSource(DataSourceRuntime.java:208)
        at org.eclipse.birt.data.engine.impl.QueryExecutor.openDataSource(QueryExecutor.java:405)
        at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:315)
        at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:448)
        at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)
        at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)
        at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:145)
        at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:560)
        at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:152)
        at org.eclipse.birt.report.engine.data.dte.DataGenerationEngine.doExecuteQuery(DataGenerationEngine.java:74)
        at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:265)
        at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1875)
        at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
        at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:75)
        at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
        at org.eclipse.birt.report.engine.internal.executor.emitter.ReportItemEmitterExecutor.execute(ReportItemEmitterExecutor.java:46)
        at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
        at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
        at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
        at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
        at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
        at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
        at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
        at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
        at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
        at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
        at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
        at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:249)

        at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:252)
        at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:85)
        at org.eclipse.birt.report.service.ReportEngineService.runReport(ReportEngineService.java:1307)
        at org.eclipse.birt.report.service.BirtViewerReportService.runReport(BirtViewerReportService.java:158)
        at org.eclipse.birt.report.service.actionhandler.BirtRunReportActionHandler.__execute(BirtRunReportActionHandler.java:81)
        at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
        at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:265)
        at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76)
        at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:120)
        at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
        at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(Unknown Source)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


Reproducible: Always

Steps to Reproduce:
1.User any report and hit request a report from birt until connections run out.
2.
3.
Comment 1 TedMalaska CLA 2010-12-27 15:44:48 EST
It looks to me the QueryExecutor should be closing the connection have the query is called.
Comment 2 TedMalaska CLA 2010-12-28 06:47:44 EST
OK after look deeper it looks like the problem is in the DataSource class in the org.eclipse.birt.data_2.5.2.v20100209.jar

The method in question is getOdaConnections.  I decouplied it in cavaj but I don't this is the right code so I'm getting the source.  Is there a newer version of org.eclipse.birt.data_2.5.2.v20100209.jar?

 private Set getOdaConnections(boolean populateToCache)
    {
        Map map = dataEngineLevelConnectionPool;
        JVM INSTR monitorenter ;
        if(dataEngineLevelConnectionPool.get(session) != null)
        {
            break MISSING_BLOCK_LABEL_58;
        }
        if(populateToCache)
        {
            dataEngineLevelConnectionPool.put(session, new HashMap());
            break MISSING_BLOCK_LABEL_58;
        }
        return new HashSet();
        Map odaConnectionsMap;
        ConnectionProp connProp;
        odaConnectionsMap = (Map)dataEngineLevelConnectionPool.get(session);
        connProp = new ConnectionProp(driverName, connectionProps, appContext);
        if(odaConnectionsMap.get(connProp) == null)
        {
            odaConnectionsMap.put(connProp, new HashSet());
        }
        (Set)odaConnectionsMap.get(connProp);
        map;
        JVM INSTR monitorexit ;
        return;
        map;
        JVM INSTR monitorexit ;
        throw ;
    }
Comment 3 TedMalaska CLA 2010-12-28 07:06:50 EST
OMG I got the real code for DataSource and a far as I can tell this is a major issue.  if there are a lot of sessions then you will continue to cache connections to the database.  Connections to the database are not unbound people.  Please fix this problem.  

private Set<CacheConnection> getOdaConnections( boolean populateToCache )
	{
		synchronized ( DataSource.dataEngineLevelConnectionPool )
		{
			if ( DataSource.dataEngineLevelConnectionPool.get( this.session ) == null )
			{
				if ( populateToCache )
				{
					DataSource.dataEngineLevelConnectionPool.put( this.session,
							new HashMap<ConnectionProp, Set<CacheConnection>>( ) );
				}
				else
				{
					return new HashSet<CacheConnection>( );
				}
			}

			Map<ConnectionProp, Set<CacheConnection>> odaConnectionsMap = DataSource.dataEngineLevelConnectionPool.get( this.session );
			ConnectionProp connProp = new ConnectionProp( this.driverName,
					this.connectionProps,
					this.appContext );
			if ( odaConnectionsMap.get( connProp ) == null )
			{
				odaConnectionsMap.put( connProp, new HashSet<CacheConnection>( ) );
			}
			return odaConnectionsMap.get( connProp );
		}
	}
Comment 4 TedMalaska CLA 2010-12-29 09:28:42 EST
In the end I upgraded my birt and the problem went away.  Sorry for the trouble.