Uploaded image for project: 'Syncope'
  1. Syncope
  2. SYNCOPE-1550

Getting "JpaSystemException: The transaction cannot be committed, because it was already marked for rollback only."

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.1.5
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None

      Description

      I have a task that is importing users from a CSV file and then creating users in a realm in Syncope 2.1.5.  This task works fine when there are only a few users in the CSV file, but if the CSV file is large (e.g., > 30K users), we are getting errors like the following in the core.log:
       

      15:04:29.529 ERROR org.apache.syncope.core.provisioning.java.job.TaskJob - While executing task 6cef6cfd-4c73-4224-af6c-fd4c733224c7
      org.springframework.orm.jpa.JpaSystemException: The transaction cannot be committed, because it was already marked for rollback only.  The transaction will be rolled back instead. The cause of the rollback-only status is reported in the embedded stack.; nested exception is <openjpa-3.1.0-rafcec21a1d489dff682a3ce7986fac6a1c80e8e0 fatal general error> org.apache.openjpa.persistence.PersistenceException: The transaction cannot be committed, because it was already marked for rollback only.  The transaction will be rolled back instead. The cause of the rollback-only status is reported in the embedded stack.
              at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:407) ~[spring-orm-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:127) ~[spring-orm-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:536) ~[spring-orm-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:746) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:714) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:534) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:305) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.apache.syncope.core.persistence.jpa.spring.DomainTransactionInterceptor.invoke(DomainTransactionInterceptor.java:60) ~[syncope-core-persistence-jpa-2.1.5.jar:2.1.5]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at com.sun.proxy.$Proxy351.execute(Unknown Source) ~[?:?]
              at org.apache.syncope.core.provisioning.java.job.TaskJob.lambda$execute$0(TaskJob.java:87) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.spring.security.AuthContextUtils.execWithAuthContext(AuthContextUtils.java:117) ~[syncope-core-spring-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.job.TaskJob.execute(TaskJob.java:76) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.3.1.jar:?]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) ~[quartz-2.3.1.jar:?]
      Caused by: org.apache.openjpa.persistence.PersistenceException: The transaction cannot be committed, because it was already marked for rollback only.  The transaction will be rolled back instead. The cause of the rollback-only status is reported in the embedded stack.
              at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:92) ~[openjpa-kernel-3.1.0.jar:3.1.0]
              at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1600) ~[openjpa-kernel-3.1.0.jar:3.1.0]
              at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:1035) ~[openjpa-kernel-3.1.0.jar:3.1.0]
              at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:669) ~[openjpa-persistence-3.1.0.jar:3.1.0]
              at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:532) ~[spring-orm-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              ... 14 more
      Caused by: org.apache.openjpa.persistence.ArgumentException
              at org.apache.openjpa.kernel.BrokerImpl.setRollbackOnly(BrokerImpl.java:1726) ~[openjpa-kernel-3.1.0.jar:3.1.0]
              at org.apache.openjpa.kernel.DelegatingBroker.setRollbackOnly(DelegatingBroker.java:1080) ~[openjpa-kernel-3.1.0.jar:3.1.0]
              at org.apache.openjpa.persistence.EntityManagerImpl.setRollbackOnly(EntityManagerImpl.java:732) ~[openjpa-persistence-3.1.0.jar:3.1.0]
              at org.springframework.orm.jpa.JpaTransactionManager$JpaTransactionObject.setRollbackOnly(JpaTransactionManager.java:682) ~[spring-orm-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.orm.jpa.JpaTransactionManager.doSetRollbackOnly(JpaTransactionManager.java:581) ~[spring-orm-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:847) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:812) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:552) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:299) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.apache.syncope.core.persistence.jpa.spring.DomainTransactionInterceptor.invoke(DomainTransactionInterceptor.java:60) ~[syncope-core-persistence-jpa-2.1.5.jar:2.1.5]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at com.sun.proxy.$Proxy86.getUserTO(Unknown Source) ~[?:?]
              at org.apache.syncope.core.provisioning.java.pushpull.DefaultUserPullResultHandler.getAnyTO(DefaultUserPullResultHandler.java:62) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.DefaultUserPullResultHandler.doCreate(DefaultUserPullResultHandler.java:80) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.AbstractPullResultHandler.create(AbstractPullResultHandler.java:272) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.AbstractPullResultHandler.provision(AbstractPullResultHandler.java:236) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.AbstractPullResultHandler.doHandle(AbstractPullResultHandler.java:816) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.AbstractPullResultHandler.handle(AbstractPullResultHandler.java:123) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at sun.reflect.GeneratedMethodAccessor749.invoke(Unknown Source) ~[?:?]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
              at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.apache.syncope.core.persistence.jpa.spring.DomainTransactionInterceptor.invoke(DomainTransactionInterceptor.java:60) ~[syncope-core-persistence-jpa-2.1.5.jar:2.1.5]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at com.sun.proxy.$Proxy353.handle(Unknown Source) ~[?:?]
              at org.apache.syncope.core.provisioning.java.ConnectorFacadeProxy$1.handle(ConnectorFacadeProxy.java:340) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.ConnectorFacadeProxy$2.handle(ConnectorFacadeProxy.java:464) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.identityconnectors.framework.impl.api.StreamHandlerUtil$ObjectStreamHandlerAdapter.handle(StreamHandlerUtil.java:101) ~[connector-framework-internal-1.5.0.1.jar:?]
              at org.identityconnectors.framework.impl.api.BufferedResultsProxy.invoke(BufferedResultsProxy.java:262) ~[connector-framework-internal-1.5.0.1.jar:?]
              at org.identityconnectors.framework.impl.api.DelegatingTimeoutProxy.invoke(DelegatingTimeoutProxy.java:94) ~[connector-framework-internal-1.5.0.1.jar:?]
              at com.sun.proxy.$Proxy354.search(Unknown Source) ~[?:?]
              at org.identityconnectors.framework.impl.api.AbstractConnectorFacade.search(AbstractConnectorFacade.java:183) ~[connector-framework-internal-1.5.0.1.jar:?]
              at org.apache.syncope.core.provisioning.java.ConnectorFacadeProxy.search(ConnectorFacadeProxy.java:454) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.ConnectorFacadeProxy.filteredReconciliation(ConnectorFacadeProxy.java:331) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.ConnectorFacadeProxy.fullReconciliation(ConnectorFacadeProxy.java:313) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.PullJobDelegate.doExecuteProvisioning(PullJobDelegate.java:349) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.PullJobDelegate.doExecuteProvisioning(PullJobDelegate.java:67) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.pushpull.AbstractProvisioningJobDelegate.doExecute(AbstractProvisioningJobDelegate.java:553) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at org.apache.syncope.core.provisioning.java.job.AbstractSchedTaskJobDelegate.execute(AbstractSchedTaskJobDelegate.java:122) ~[syncope-core-provisioning-java-2.1.5.jar:2.1.5]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
              at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) ~[spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
              ... 10 more
      

       
      I don't really understand why this error is happening, but from googling, and threads such as:
       
      https://stackoverflow.com/questions/25322658/could-not-commit-jpa-transaction-transaction-marked-as-rollbackonly
       
      that seems to indicate that the problem might be a problem with Syncope code (but I don't understand why it would only happen with larger CSV files)?
       
      Is there something that we can do, configuration-wise, to avoid this problem?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ohaya ohaya
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: