RuntimeException in a Select max() query
Hi all, we are long time users of H2 and have come to love it's versatility. This love is not free of bumps though. We've just faced the most strange one: (excerpt stack trace, full stack trace at bottom) General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement: select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [5-160] at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) at org.h2.message.DbException.get(DbException.java:158) at org.h2.message.DbException.convert(DbException.java:281) at org.h2.command.Command.executeQuery(Command.java:189) We are using *com.h2database:h2:1.3.160* and at this stage of the development we can't afford upgrading the version. We connect to the DB using the URL: jdbc:h2:C:\path\to\db;MAX_MEMORY_UNDO=2;MAX_OPERATION_MEMORY=2;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10;IFEXISTS=TRUE;MVCC=TRUE;CIPHER=AES;DB_CLOSE_ON_EXIT=FALSE All the information (symptoms) we have are : * We* can't *reproduce the error in a *single threaded* application with *high DB load*. * We* can't* reproduce the error in a *multi threaded* application with *low DB load*. * We* can* reproduce the error in a *multi threaded* application with *high DB load*. Any help/feedback will be welcome. Thanks in advance, Ignasi -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/AyAAqx58VuMJ. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: RuntimeException in a Select max() query
Hi Could you post the rest of the stack tragen please? Regards, Thomas Am 28.09.2012 09:11 schrieb "Ignasi Marimon-Clos i Sunyol" < ignas...@gmail.com>: > Hi all, > > we are long time users of H2 and have come to love it's versatility. This > love is not free of bumps though. > > We've just faced the most strange one: > > (excerpt stack trace, full stack trace at bottom) > > General error: "java.lang.RuntimeException: Unexpected code path"; SQL > statement: > select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? > [5-160] > at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) > at org.h2.message.DbException.get(DbException.java:158) > at org.h2.message.DbException.convert(DbException.java:281) > at org.h2.command.Command.executeQuery(Command.java:189) > > > > We are using *com.h2database:h2:1.3.160* and at this stage of the > development we can't afford upgrading the version. > > We connect to the DB using the URL: > > > jdbc:h2:C:\path\to\db;MAX_MEMORY_UNDO=2;MAX_OPERATION_MEMORY=2;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10;IFEXISTS=TRUE;MVCC=TRUE;CIPHER=AES;DB_CLOSE_ON_EXIT=FALSE > > > All the information (symptoms) we have are : > > * We* can't *reproduce the error in a *single threaded* application with *high > DB load*. > * We* can't* reproduce the error in a *multi threaded* application with *low > DB load*. > * We* can* reproduce the error in a *multi threaded* application with *high > DB load*. > > > Any help/feedback will be welcome. Thanks in advance, > > Ignasi > > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/h2-database/-/AyAAqx58VuMJ. > To post to this group, send email to h2-database@googlegroups.com. > To unsubscribe from this group, send email to > h2-database+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: RuntimeException in a Select max() query
Sorry, I mentioned that in my previous e-mail but forgot the attachment: 2012-09-27 18:22:50,434 ERROR [Thread-1] (Context.java:282) Calling onError of com.myBizz.edmpb.addressbook.sm.UserDetailsState@1d56250 for org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_]; SQL state [HY000]; error code [5]; General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement: select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [5-160]; nested exception is org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement: select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [5-160] org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_]; SQL state [HY000]; error code [5]; General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement: select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [5-160]; nested exception is org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement: select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [5-160] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:1046) at com.myBizz.edmpb.dao.ExtendedEntityDaoImpl.get(ExtendedEntityDaoImpl.java:213) at com.myBizz.edmpb.dao.ExtendedEntityDaoImpl.getUnique(ExtendedEntityDaoImpl.java:231) at com.myBizz.edmpb.dao.ExtendedEntityDaoImpl.getUnique(ExtendedEntityDaoImpl.java:222) at com.myBizz.edmpb.services.communication.queueing.repositories.AbstractQueueRepository.lastQueuePosition(AbstractQueueRepository.java:538) at com.myBizz.edmpb.services.communication.queueing.repositories.AbstractQueueRepository.findTailPackageId(AbstractQueueRepository.java:508) at com.myBizz.edmpb.communication.queueing.Queue.findTailPackageId(Queue.java:95) at com.myBizz.edmpb.communication.translation.builder.RawPackageBuilderImpl.buildPackage(RawPackageBuilderImpl.java:53) at com.myBizz.edmpb.services.communication.translation.builder.SynchronizationPackageBuilderImpl.buildPackageOperation(SynchronizationPackageBuilderImpl.java:90) [...] Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement: select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [5-160] at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) at org.h2.message.DbException.get(DbException.java:158) at org.h2.message.DbException.convert(DbException.java:281) at org.h2.command.Command.executeQuery(Command.java:189) at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:96) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1787) at org.hibernate.loader.Loader.doQuery(Loader.java:674) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2213) at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2136) at org.hibernate.loader.Loader.list(Loader.java:2096) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1056) at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ... 35 more Caused by: java.lang.RuntimeException: Unexpected code path at org.h2.message.DbException.throwInternalError(DbException.java:228) at org.h2.message.
Re: RuntimeException in a Select max() query
Turn off MVCC. Thomas, perhaps the MVCC option should be disabled, since it keeps causing problems ? On 2012-10-01 10:02, Ignasi Marimon-Clos i Sunyol wrote: -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Re: RuntimeException in a Select max() query
Turning off MVCC is not feasible at this time. And we are not uncomfortable with MVCC. It's only that we are not aware of MVCC's limitations (like concurrent updates when a select max() is run). We worked around the issue by denormalizing the data and maintaining that MAX value on a separate table. Thanks for all the feedback. On Tuesday, October 2, 2012 8:45:24 AM UTC+2, Noel Grandin wrote: > > Turn off MVCC. > > Thomas, perhaps the MVCC option should be disabled, since it keeps > causing problems ? > > On 2012-10-01 10:02, Ignasi Marimon-Clos i Sunyol wrote: > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/8hun37BRkogJ. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.