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 [50000]; General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement:
select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [50000-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 ? [50000-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 [50000]; General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement:
select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [50000-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 ? [50000-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 ? [50000-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.DbException.throwInternalError(DbException.java:241)
at org.h2.index.PageDataCursor.previous(PageDataCursor.java:102)
at org.h2.index.MultiVersionCursor.step(MultiVersionCursor.java:73)
at org.h2.index.MultiVersionCursor.loadNext(MultiVersionCursor.java:57)
at org.h2.index.MultiVersionCursor.next(MultiVersionCursor.java:105)
at org.h2.index.MultiVersionCursor.previous(MultiVersionCursor.java:179)
at org.h2.index.MultiVersionIndex.findFirstOrLast(MultiVersionIndex.java:113)
at org.h2.expression.Aggregate.getValue(Aggregate.java:279)
at org.h2.expression.Alias.getValue(Alias.java:35)
at org.h2.command.dml.Select.queryQuick(Select.java:542)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:607)
at org.h2.command.dml.Query.query(Query.java:298)
at org.h2.command.dml.Query.query(Query.java:268)
at org.h2.command.dml.Query.query(Query.java:37)
at org.h2.command.CommandContainer.query(CommandContainer.java:82)
at org.h2.command.Command.executeQuery(Command.java:185)
... 49 more
2012-09-27 18:22:50,434 ERROR [Thread-1] (EpbaddressbookState.java:77) 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 [50000]; General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement:
select max(this_.QUEUE_POSITION) as y0_ from HISTORY_QUEUE this_ limit ? [50000-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 ? [50000-160]
2012-09-27 18:22:50,434 INFO [Thread-1] (UserDetailsState.java:1023) EXITING UserDetailsState STATE
We finally managed to reproduce the error and we suspect the conditions are:
- thread 1 opens transaction
- thread 2 opens transaction
- thread 2 inserts Item in table Foo
- thread 1 runs a select max(col) in table Foo
Or similar.
We could only see the error when both Threads were using transactions.
Thanks for the help!