[Mondrian] [Olap4j-devel] connection issues with mondrianOlap4j

Marc Batchelor mbatchelor at pentaho.com
Fri Jun 10 14:42:42 EDT 2011

It should appear in catalina.out - just wait for a bit and then force a GC...

If you have a leak it will show up. Prove the leak output using a quick JSP that grabs a connection from the pool and doesnt cvall close.

Sent from an unidentified device

-----Original Message-----
From: Paul Stoellberger <p.stoellberger at gmail.com>
Sender: "mondrian-bounces at pentaho.org" <mondrian-bounces at pentaho.org>
Date: Fri, 10 Jun 2011 13:06:14 
To: Mondrian developer mailing list<mondrian at pentaho.org>; olap4j-devel at lists.sourceforge.net<olap4j-devel at lists.sourceforge.net>
Reply-To: Mondrian developer mailing list <mondrian at pentaho.org>
Subject: Re: [Mondrian] [Olap4j-devel] connection issues with mondrianOlap4j

My JNDI looks like that.
No log entry whatsoever anywhere though :/

        <Resource name="jdbc/Foodmart" auth="Container" type="javax.sql.DataSource"
                           factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="40" maxIdle="10"
                           maxWait="10000" username="pentaho_user" password="password"
                           driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/foodmart"
                           removeAbandoned="true"  logAbandoned="true"  
                           validationQuery="select count(*) from foodmart.store;"/>


On Jun 10, 2011, at 18:48 , Marc Batchelor wrote:

> If you can configure your connection using DBCP in Tomcat, the resource definition does in fact allow you to identify abandoned connections:
> Look at the logAbandoned, removeAbandoned, and removeAbandonedTimeout settings:
> <Resource name="jdbc/SampleData" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="5" maxWait="10000"
>        username="pentaho_user" password="xxxxxx"
>        factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>        driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/sampledata"
>        logAbandoned="true"
>        removeAbandoned="true" 
>        removeAbandonedTimeout="300"
>        validationQuery="/* ping */" 
> />
> What's nice is that when a connection is deemed abandoned, either by the reaping thread setup in the removeAbandonedTimeout, or when a finalizer kicks in on the connection instance, it will send to the log a stack dump of the code that grabbed the connection in the first place.
> Marc
> -----Original Message-----
> From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On Behalf Of Paul Stoellberger
> Sent: Friday, June 10, 2011 1:25 PM
> To: Julian Hyde
> Cc: olap4j-devel at lists.sourceforge.net; 'Mondrian developer mailing list'
> Subject: Re: [Mondrian] [Olap4j-devel] connection issues with mondrianOlap4j
> Hi,
> I was trying all afternoon to come up with a Testcase or even figure out how I could get more debug info from DBCP / Mondrian.
> Unfortunately I was not successful at all.
> There is no logging in DBCP or mondrian regarding the pool.
> I think this issue is related to the internal Pool (RolapConnectionPool) since its happening to JDBC connection as well as JNDI.
> Any input on how I could debug / test it would be appreciated.
> Otherwise I need to file a bug without any more detailed info.
> -Paul
> On Jun 8, 2011, at 20:57 , Julian Hyde wrote:
>> Sounds like JDBC connections are being taken from the connection pool 
>> but not returned. The pool is finite: there can be no more than N open 
>> connections at a time. When they ask for connection N+1 it will block 
>> and eventually time out.
>> The connection leak is likely to be in Mondrian's code, and not your fault.
>> Likely there is an error and Mondrian is not returning the connection 
>> to the pool.
>> Keeping olap4j connections open shouldn't be the problem. Mondrian 
>> does not keep JDBC connections open for the duration of an olap4j 
>> connection -- it opens & closes them (more precisely borrows & returns 
>> them) for each access to the database.
>> Please log a bug with a testcase. Or maybe there's tracing in dbcp you 
>> can enable to show the callstack for each of the still-open connections.
>> Julian
>>> -----Original Message-----
>>> From: mondrian-bounces at pentaho.org
>>> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Paul Stoellberger
>>> Sent: Wednesday, June 08, 2011 10:12 AM
>>> To: olap4j-devel at lists.sourceforge.net; Mondrian developer mailing 
>>> list
>>> Subject: [Mondrian] connection issues with mondrianOlap4j
>>> Hi,
>>> since quite a while we are experiencing very strange behaviour on our 
>>> demo.
>>> At some point olap4j / mondrian cant execute any queries anymore.
>>> We were initially using normal jdbc based connections for mondrian / 
>>> olap4j. Which resulted in "freeze" behaviour without any info in any 
>>> log file what went wrong whenever mondrian tried to execute something 
>>> on the database
>>> Now with JNDI i get the following exception:
>>>       at
>>> mondrian.rolap.RolapConnection.execute(RolapConnection.java:582)
>>>       ... 79 more
>>> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a 
>>> connection, pool error Timeout waiting for idle object
>>>       at
>>> org.apache.commons.dbcp.PoolingDataSource.getConnection(Poolin
>>> gDataSource.java:104)
>>>       at
>>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDat
>>> aSource.java:880)
>>>       at mondrian.rolap.SqlStatement.execute(SqlStatement.java:123)
>>>       ... 90 more
>>> Caused by: java.util.NoSuchElementException: Timeout waiting for idle 
>>> object
>>>       at
>>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Ge
>>> nericObjectPool.java:958)
>>>       at
>>> org.apache.commons.dbcp.PoolingDataSource.getConnection(Poolin
>>> gDataSource.java:96)
>>>       ... 92 more
>>> In our workflow we create one olap4j connection on server startup and 
>>> use that to create new Query objects.
>>> We never close any connections, nor remove query objects that are 
>>> abandoned by users, we keep them indefinitely at the moment.
>>> I was looking at the log files and saw that the error occurred 
>>> suddenly, not after a timeout or something. There was something 
>>> successfully executed 5 mins before on the database.
>>> Mysql doesn't report anything on "SHOW PROCESSLIST", so i'm assuming 
>>> the connection pool is not exhausted from the DB point of view, but 
>>> rather because of mondrian.
>>> Is there anything in our workflow that could  cause mondrian to 
>>> behave like that?
>>> Does it not close its jdbc connections?
>>> This error occurs with both, mysql and hsqldb.
>>> I'm running out of ideas what i could do to fix or even debug this 
>>> issues.
>>> If anyone has any idea on what I could try, please step forward ;-)
>>> -Paul
>>> Mondrian mailing list
>>> Mondrian at pentaho.org
>>> http://lists.pentaho.org/mailman/listinfo/mondrian
>> ----------------------------------------------------------------------
>> -------- EditLive Enterprise is the world's most technically advanced 
>> content authoring tool. Experience the power of Track Changes, Inline 
>> Image Editing and ensure content is compliant with Accessibility 
>> Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> olap4j-devel mailing list
>> olap4j-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/olap4j-devel
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

Mondrian mailing list
Mondrian at pentaho.org

More information about the Mondrian mailing list