You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Keith Naas <Ke...@dswinc.com> on 2012/04/18 18:42:37 UTC

Maximum Open Cursors using JdbcDataSource and cacheImpl

After upgrading from 3.5.0 to 3.6.0 we have noticed that when we use a cacheImpl  on a nested JdbcDataSource entity, the database runs out of cursors.  It does not matter what transactionIsolation, autoCommit, or holdability setting we use.  I have only been using solr for a few months but after looking at EntityProcessorBase, DIHCacheSupport, and JdbcDataSource.ResultSetIterator it may be that the ResultSet or Statement is never closed.  In EntityProcessBase.getNext() if there is no cacheSupport it likely immediately closes the resources it was using.  Whereas with caching it might be leaving it open because the rowIterator is never set to null.  Since it has a reference to the resultSet and stmt it holds onto them and neither is ever closed.

On a related note there appear to be other possible leaks in JdbcDataSource.ResultSetIterator. The close() method attempts to close both the resultSet and the stmt.  However if it fails closing the resultSet it will not close the stmt.  They should probably be wrapped in separate try/catch blocks.  It will also not close the stmt or resultSet if the ResultSetIterator throws an exception in its constructor.  In my experience one cannot count on the closing of the connection to cleanup those resources consistently.

      2012-04-18 12:02:22,017 ERROR [org.apache.solr.handler.dataimport.DataImporter] Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select distinct DISPLAY_NAME from dimension where dimension.DIMENSION_ID = 'M' Processing Document # 11
            at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:264)
            at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:375)
            at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:445)
            at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:426)
        Caused by: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select distinct DISPLAY_NAME from dimension where dimension.DIMENSION_ID = 'M' Processing Document # 11
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:621)
            at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:327)
            at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:225)
            ... 3 more
        Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select distinct DISPLAY_NAME from dimension where dimension.DIMENSION_ID = 'M' Processing Document # 11
            at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
            at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253)
            at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
            at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
            at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
            at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
            at org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:330)
            at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:296)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:683)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:709)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:709)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:619)
            ... 5 more
        Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded

            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
            at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
            at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
            at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:804)
            at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
            at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:845)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1146)
            at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1726)
            at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1696)
            at org.jboss.resource.adapter.jdbc.WrappedStatement.execute(WrappedStatement.java:97)
            at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:246)

Cheers,
Keith Naas
614-238-4139


RE: Maximum Open Cursors using JdbcDataSource and cacheImpl

Posted by "Dyer, James" <Ja...@ingrambook.com>.
Keith,

Can you supply your data-config.xml ?

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: Keith Naas [mailto:KeithNaas@dswinc.com] 
Sent: Wednesday, April 18, 2012 11:43 AM
To: solr-user@lucene.apache.org
Subject: Maximum Open Cursors using JdbcDataSource and cacheImpl

After upgrading from 3.5.0 to 3.6.0 we have noticed that when we use a cacheImpl  on a nested JdbcDataSource entity, the database runs out of cursors.  It does not matter what transactionIsolation, autoCommit, or holdability setting we use.  I have only been using solr for a few months but after looking at EntityProcessorBase, DIHCacheSupport, and JdbcDataSource.ResultSetIterator it may be that the ResultSet or Statement is never closed.  In EntityProcessBase.getNext() if there is no cacheSupport it likely immediately closes the resources it was using.  Whereas with caching it might be leaving it open because the rowIterator is never set to null.  Since it has a reference to the resultSet and stmt it holds onto them and neither is ever closed.

On a related note there appear to be other possible leaks in JdbcDataSource.ResultSetIterator. The close() method attempts to close both the resultSet and the stmt.  However if it fails closing the resultSet it will not close the stmt.  They should probably be wrapped in separate try/catch blocks.  It will also not close the stmt or resultSet if the ResultSetIterator throws an exception in its constructor.  In my experience one cannot count on the closing of the connection to cleanup those resources consistently.

      2012-04-18 12:02:22,017 ERROR [org.apache.solr.handler.dataimport.DataImporter] Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select distinct DISPLAY_NAME from dimension where dimension.DIMENSION_ID = 'M' Processing Document # 11
            at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:264)
            at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:375)
            at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:445)
            at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:426)
        Caused by: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select distinct DISPLAY_NAME from dimension where dimension.DIMENSION_ID = 'M' Processing Document # 11
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:621)
            at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:327)
            at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:225)
            ... 3 more
        Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select distinct DISPLAY_NAME from dimension where dimension.DIMENSION_ID = 'M' Processing Document # 11
            at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
            at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253)
            at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
            at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
            at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
            at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
            at org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:330)
            at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:296)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:683)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:709)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:709)
            at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:619)
            ... 5 more
        Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded

            at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
            at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
            at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
            at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:804)
            at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
            at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:845)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1146)
            at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1726)
            at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1696)
            at org.jboss.resource.adapter.jdbc.WrappedStatement.execute(WrappedStatement.java:97)
            at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:246)

Cheers,
Keith Naas
614-238-4139