[Hibernate-JIRA] Created: (HHH-2033) "ORA-01000: maximum open cursors exceeded" with incomplete iterations
by Frederic Leitenberger (JIRA)
"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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 5 months
[Hibernate-JIRA] Commented: (HHH-759) problem for mixxing setmaxresults and setlockmode
by Frederic Leitenberger (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-759?page=co... ]
Frederic Leitenberger commented on HHH-759:
-------------------------------------------
A database-specific (Oracle only?) workaround is to limit the resultset in the query itself.
For example like this:
Query query = session.createQuery("from Table where rownum <= 1");
query.setLockMode(...);
> problem for mixxing setmaxresults and setlockmode
> -------------------------------------------------
>
> Key: HHH-759
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-759
> Project: Hibernate3
> Type: Bug
> Versions: 3.0.2
> Environment: Client:windows2000 professional,jre1.4.2, oracle8client,eclipse3.1-RC3,hibernate-tools 3.0 alpha4a,JBossIDE1.5M1
> Server:Solaris 2.8, oracle 8.1.7
> Reporter: johnhua
> Priority: Minor
>
>
> there is a problem for mixxing setmaxresults and setlockmode.
> the problem is that "ORA-00904: invalid column name".
> The error info is as the below:
> Hibernate: select * from ( select idmapp0_.RI as col_0_0_ from PCTMNGT.IDMAP_P idmapp0_ where idmapp0_.STATUS=? ) where rownum <= ? for update of idmapp0_.RI
> 14:21:54,076 DEBUG AbstractBatcher:AbstractBatcher.java:365 - preparing statement
> 14:21:54,082 DEBUG AbstractBatcher:AbstractBatcher.java:285 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
> 14:21:54,083 DEBUG AbstractBatcher:AbstractBatcher.java:403 - closing statement
> 14:21:54,090 WARN JDBCExceptionReporter:JDBCExceptionReporter.java:71 - SQL Error: 904, SQLState: 42000
> 14:21:54,091 ERROR JDBCExceptionReporter:JDBCExceptionReporter.java:72 - ORA-00904: invalid column name
> The source code is as the below:
> //query an unused emid for new tone
> query = av_session.createQuery("select v_idmap from IdmapP as v_idmap where v_idmap.status=:v_status");
> query.setCharacter("v_status",EMID_STATUS.UNUSED.charValue());
> query.setMaxResults(1);
> query.setLockMode("v_idmap",LockMode.UPGRADE);
> it = query.iterate();
> if( !it.hasNext() )
> {
> tx.rollback();
> lv_err = "addRing::doAddRingFile: no unused EMID for new tone in idmap. toneid="+av_tone;
> throw new InterfaceErrException(lv_err,INTERFACE_RETCODE.SYSTEM_ERR);
> }
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1365) NPE AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372) when trying to load a class defined in a signed/sealed JAR
by Wolfgang Fahl (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1365?page=c... ]
Wolfgang Fahl commented on HHH-1365:
------------------------------------
The patch from Martin Schulz did not work for me immediately since I got an error like:
Caused by: java.lang.SecurityException: class "org.hibernate.proxy.HibernateProxy$$FastClassByCGLIB$$76d69142"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:611)
at java.lang.ClassLoader.defineClass(ClassLoader.java:532)
... 66 more
Which is not caused in the Enhanser but in FastClass. So going by the same pattern started by Martin
i added:
RCS file: /usr/cvsroot/Source/Java/cglib/src/proxy/net/sf/cglib/reflect/FastClass.java,v
retrieving revision 1.1
diff -r1.1 FastClass.java
59a60
> this.setProtDomainSrc(type);
Now the above error is gone - Thank you Martin!
> NPE AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372) when trying to load a class defined in a signed/sealed JAR
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1365
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1365
> Project: Hibernate3
> Type: Bug
> Versions: 3.1
> Environment: Java1.5.06 Ant1.7alpha, hibernate 3.1
> Reporter: Steve Loughran
> Priority: Minor
> Attachments: cglib-src-2.1_3.patch
>
>
> I'm testing what happens to hibernate when running against a signed JAR. The answer is: most tests pass. What fails is this test (Apache 2.0 license, BTW)
> public void testDetachedObject() throws Exception {
> Event event = createTestEvent();
> session.save(event);
> session.flush();
> closeSession();
> //here the event is detached.
> //we change it outside an operation.
> String text = "modified";
> event.setText(text);
> session = getSessionFactory().openSession();
> Event merged=(Event) session.merge(event);
> assertEquals(event, merged);
> session.flush();
> closeSession();
> session = getSessionFactory().openSession();
> Event loaded = (Event) session.load(Event.class, event.getKey());
> assertEquals(text, loaded.getText());
> assertEquals(event, loaded);
> }
> the session.load operation is failing, with the short stack trace of:
> java.lang.NullPointerException
> at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
> at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
> at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
> at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
> at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:869)
> at org.hibernate.impl.SessionImpl.load(SessionImpl.java:788)
> at org.hibernate.impl.SessionImpl.load(SessionImpl.java:781)
> at d1.persist.test.SessionTest.testDetachedObject(SessionTest.java:155)
> The root cause is probably contained in the info that gets printed when the session starts up, complaining that things cant be added to sealed classes
> [junit] 2261 ERROR org.hibernate.proxy.BasicLazyInitializer - CGLIB Enhancement failed: d1.persist.Event
> [junit] net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> [junit] at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> [junit] at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> [junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:126)
> [junit] at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
> [junit] at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
> [junit] at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
> [junit] at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
> [junit] at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
> [junit] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
> [junit] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
> [junit] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
> [junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
> [junit] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:375)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:533)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:109)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:155)
> [junit] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:82)
> [junit] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> [junit] at d1.persist.PersistTools.createManagerFactory(PersistTools.java:82)
> [junit] at d1.persist.PersistTools.createDefaultManagerFactory(PersistTools.java:76)
> [junit] at d1.persist.test.Ejb3TestBase.setUp(Ejb3TestBase.java:27)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:125)
> [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
> [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:118)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:328)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:736)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:605)
> [junit] Caused by: java.lang.reflect.InvocationTargetException
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> [junit] ... 33 more
> [junit] Caused by: java.lang.SecurityException: class "d1.persist.Event$$EnhancerByCGLIB$$55c8eae8_2"'s signer information does not match signer information of other classes in the same package
> [junit] at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)
> [junit] at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
> [junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
> [junit] ... 39 more
> [junit] 2262 WARN org.hibernate.tuple.PojoEntityTuplizer - could not create proxy factory for:d1.persist.Event
> [junit] org.hibernate.HibernateException: CGLIB Enhancement failed: d1.persist.Event
> [junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
> [junit] at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
> [junit] at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
> [junit] at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
> [junit] at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
> [junit] at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
> [junit] at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
> [junit] at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
> [junit] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
> [junit] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:215)
> [junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
> [junit] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:375)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:533)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:109)
> [junit] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:155)
> [junit] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:82)
> [junit] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> [junit] at d1.persist.PersistTools.createManagerFactory(PersistTools.java:82)
> [junit] at d1.persist.PersistTools.createDefaultManagerFactory(PersistTools.java:76)
> [junit] at d1.persist.test.Ejb3TestBase.setUp(Ejb3TestBase.java:27)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:125)
> [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
> [junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:118)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:328)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:736)
> [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:605)
> [junit] Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
> [junit] at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> [junit] at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> [junit] at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:126)
> [junit] ... 30 more
> [junit] Caused by: java.lang.reflect.InvocationTargetException
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [junit] at java.lang.reflect.Method.invoke(Method.java:585)
> [junit] at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
> [junit] at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
> [junit] ... 33 more
> [junit] Caused by: java.lang.SecurityException: class "d1.persist.Event$$EnhancerByCGLIB$$55c8eae8_2"'s signer information does not match signer information of other classes in the same package
> [junit] at java.lang.ClassLoader.checkCerts(ClassLoader.java:775)
> [junit] at java.lang.ClassLoader.preDefineClass(ClassLoader.java:487)
> [junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
> [junit] ... 39 more
> No doubt there is some way to configure hibernate to create proxies in a different package, and I shall seek that option out. All I want to note here is that NPEs are not the best way to report failure.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
18 years, 5 months