[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2033) "ORA-01000: maximum open cursors exceeded" with incomplete iterations

Frederic Leitenberger (JIRA) noreply at atlassian.com
Mon Aug 28 04:59:24 EDT 2006


"ORA-01000: maximum open cursors exceeded" with incomplete iterations
---------------------------------------------------------------------

         Key: HHH-2033
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2033
     Project: Hibernate3
        Type: Bug

  Components: query-sql  
    Versions: 3.1.2    
 Environment: Hibernate: 3.1.2
Client: Suse Linux
Database: Oracle 9i
    Reporter: Frederic Leitenberger
    Priority: Critical
 Attachments: HibernateAbortIterateTest.java

When using iterate and NOT iterating through all items, the cursor stays open.
When repeating this several times the "maximum open cursors exceeded" - exception occurs.

This problem occured in the following situation:
We have an import tool, which reads one line from an import-file and queries the database for colliding/overlapping objects.
The objects are loaded whit iterate. The first object which doesn't fit the new input throws an exception and so leaves the iterate-loop.

There is no function to close the iterator explicitly.
This would solve the problem (once the developer is aware of it).


My current workaround ist to use query.list().iterator() instead of query.iterate().
But this is only applicable with small resultsets.


I'll do an update of Hibernate soon and see if it still occurs.

The attached test crashes after 300 iterations.
300 is the open cursor limit for my DB.


org.hibernate.exception.GenericJDBCException: could not execute query using iterate
	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
	at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:420)
	at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:318)
	at org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:177)
	at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1177)
	at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46)
	at de.iccs.test.HibernateAbortIterateTest.testAbortIterate(HibernateAbortIterateTest.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded

	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
	at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
	at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
	at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
	at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
	at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
	at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
	at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
	at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2929)
	at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
	at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
	at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:397)
	... 20 more



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list