Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.polyjdbc.core.exception.SequenceLimitReachedException: [SEQUENCE_LIMIT_REACHED] Sequence jv_commit_pk_seq has reached its limit #475

Closed
achimbitzer opened this issue Dec 7, 2016 · 2 comments
Labels

Comments

@achimbitzer
Copy link

@achimbitzer achimbitzer commented Dec 7, 2016

We encountered this error while running multithreaded performance tests on our application, which uses Javers for versioning of database changes. See below for full stack trace.

I think this looks like an error inside or while accessing the polyjdbc class Sequence without proper synchronisation for thread safety, so this may be a bug inside polyjdbc. Therefore I've created an issue for polyjdbc, too: polyjdbc/polyjdbc#22

Do you think this assumption for the cause of the exception is correct?

Suggestions for fixing this in Javers:

  • either update polyjdbc when this issue is fixed in polyjdbc
  • or implement a workaround to ensure thread safety in this case.

org.polyjdbc.core.exception.SequenceLimitReachedException: [SEQUENCE_LIMIT_REACHED] Sequence jv_commit_pk_seq has reached its limit of 8899. Before fetching value, check if recalculation is needed using recalculationNeeded() method. at org.polyjdbc.core.key.Sequence.nextValue(Sequence.java:50) ~[Sequence.class:?] at org.polyjdbc.core.key.SequenceAllocation.generateKey(SequenceAllocation.java:55) ~[SequenceAllocation.class:?] at org.polyjdbc.core.query.TransactionalQueryRunner.insert(TransactionalQueryRunner.java:108) ~[TransactionalQueryRunner.class:?] at org.javers.repository.sql.repositories.CommitMetadataRepository.insertCommit(CommitMetadataRepository.java:46) ~[CommitMetadataRepository.class:?] at org.javers.repository.sql.repositories.CommitMetadataRepository.save(CommitMetadataRepository.java:34) ~[CommitMetadataRepository.class:?] at org.javers.repository.sql.JaversSqlRepository.persist(JaversSqlRepository.java:63) ~[JaversSqlRepository.class:?] at org.javers.repository.api.JaversExtendedRepository.persist(JaversExtendedRepository.java:109) ~[JaversExtendedRepository.class:?] at org.javers.core.JaversCore.commit(JaversCore.java:80) ~[JaversCore.class:?] at org.javers.spring.jpa.JaversTransactionalDecorator.commit(JaversTransactionalDecorator.java:59) ~[JaversTransactionalDecorator.class:?] at org.javers.spring.jpa.JaversTransactionalDecorator$$FastClassBySpringCGLIB$$acb40bd0.invoke(<generated>) ~[JaversTransactionalDecorator.class:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[MethodProxy.class:4.2.4.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[CglibAopProxy$CglibMethodInvocation.class:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[ReflectiveMethodInvocation.class:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[TransactionInterceptor$1.class:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[TransactionAspectSupport.class:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[TransactionInterceptor.class:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[ReflectiveMethodInvocation.class:4.2.4.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) ~[CglibAopProxy$DynamicAdvisedInterceptor.class:4.2.4.RELEASE] at org.javers.spring.jpa.JaversTransactionalDecorator$$EnhancerBySpringCGLIB$$aa8dbc27.commit(<generated>) ~[JaversTransactionalDecorator.class:?] at org.javers.spring.auditable.aspect.springdata.OnSaveAuditChangeHandler.handle(OnSaveAuditChangeHandler.java:18) ~[OnSaveAuditChangeHandler.class:?] at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.applyVersionChange(JaversSpringDataAuditableRepositoryAspect.java:82) ~[JaversSpringDataAuditableRepositoryAspect.class:?] at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.applyVersionChanges(JaversSpringDataAuditableRepositoryAspect.java:77) ~[JaversSpringDataAuditableRepositoryAspect.class:?] at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.onVersionEvent(JaversSpringDataAuditableRepositoryAspect.java:59) ~[JaversSpringDataAuditableRepositoryAspect.class:?] at org.javers.spring.auditable.aspect.springdata.JaversSpringDataAuditableRepositoryAspect.onSaveExecuted(JaversSpringDataAuditableRepositoryAspect.java:47) ~[JaversSpringDataAuditableRepositoryAspect.class:?] at sun.reflect.GeneratedMethodAccessor1765.invoke(Unknown Source) ~[?:?]

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Dec 10, 2016

Thanks for reporting, we will check it.
Could you push the reproduction scenario (a failing test)?

bartoszwalacik added a commit that referenced this issue Dec 12, 2016
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Dec 13, 2016

fixed in javers 2.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants