Uploaded image for project: 'Apache Fineract'
  1. Apache Fineract
  2. FINERACT-1086

JpaOptimisticLockingFailureException at LoanSchedularServiceImpl.recalculateInterest() - requires retry logic?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      See FINERACT-932 for general background; I've found this in logs of https://www.fineract.dev:

      org.springframework.orm.jpa.JpaOptimisticLockingFailureException: Optimistic locking errors were detected when flushing to the data store. The following objects may have been concurrently modified in another transaction: [org.apache.fineract.portfolio.loanaccount.domain.Loan-12, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-148, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-146, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-144, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-149, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-141, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-145, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-140, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-142, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-147, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-143, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-150, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3944, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3942, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3945, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3941, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3940, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3939, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3937, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3938, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3943, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3946, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3947]; nested exception is <openjpa-3.1.1-r1440702 nonfatal store error> org.apache.openjpa.persistence.OptimisticLockException: Optimistic locking errors were detected when flushing to the data store. The following objects may have been concurrently modified in another transaction: [org.apache.fineract.portfolio.loanaccount.domain.Loan-12, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-148, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-146, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-144, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-149, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-141, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-145, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-140, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-142, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-147, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-143, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-150, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3944, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3942, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3945, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3941, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3940, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3939, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3937, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3938, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3943, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3946, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3947]
      
              at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible (EntityManagerFactoryUtils.java:397)
              at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible (DefaultJpaDialect.java:128)
              at org.springframework.orm.jpa.JpaTransactionManager.doCommit (JpaTransactionManager.java:538)
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit (AbstractPlatformTransactionManager.java:743)
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit (AbstractPlatformTransactionManager.java:711)
              at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning (TransactionAspectSupport.java:631)
              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction (TransactionAspectSupport.java:385)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java:118)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:186)
              at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed (CglibAopProxy.java:749)
              at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept (CglibAopProxy.java:691)
              at org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformServiceJpaRepositoryImpl$$EnhancerBySpringCGLIB$$f838ffc.recalculateInterest (<generated>)
              at org.apache.fineract.portfolio.loanaccount.service.LoanSchedularServiceImpl.recalculateInterest (LoanSchedularServiceImpl.java:138)
              at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
              at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
              at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke (Method.java:566)
              at org.springframework.util.MethodInvoker.invoke (MethodInvoker.java:283)
              at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:267)
              at org.springframework.scheduling.quartz.QuartzJobBean.execute (QuartzJobBean.java:75)
              at org.quartz.core.JobRunShell.run (JobRunShell.java:202)
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:573)
      
      Caused by: <openjpa-3.1.1-r1440702 nonfatal store error> org.apache.openjpa.persistence.OptimisticLockException: Optimistic locking errors were detected when flushing to the data store. The following objects may have been concurrently modified in another transaction: [org.apache.fineract.portfolio.loanaccount.domain.Loan-12, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-148, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-146, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-144, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-149, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-141, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-145, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-140, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-142, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-147, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-143, org.apache.fineract.portfolio.loanaccount.domain.LoanInterestRecalcualtionAdditionalDetails-150, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3944, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3942, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3945, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3941, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3940, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3939, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3937, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3938, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3943, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3946, org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment-3947]
      
              at org.apache.openjpa.kernel.BrokerImpl.newFlushException (BrokerImpl.java:2459)
              at org.apache.openjpa.kernel.BrokerImpl.flush (BrokerImpl.java:2308)
              at org.apache.openjpa.kernel.BrokerImpl.flushSafe (BrokerImpl.java:2199)
              at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion (BrokerImpl.java:2116)
              at org.apache.openjpa.kernel.LocalManagedRuntime.commit (LocalManagedRuntime.java:84)
              at org.apache.openjpa.kernel.BrokerImpl.commit (BrokerImpl.java:1600)
              at org.apache.openjpa.kernel.DelegatingBroker.commit (DelegatingBroker.java:1035)
              at org.apache.openjpa.persistence.EntityManagerImpl.commit (EntityManagerImpl.java:669)
              at org.springframework.orm.jpa.JpaTransactionManager.doCommit (JpaTransactionManager.java:534)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vorburger Michael Vorburger
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: