Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-11360

JCAOrderedLastSynchronizationList shouldn't be skipped for org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry registered Synchronizations

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 15.0.0.Final
    • 15.0.0.Beta1
    • Transactions
    • None
    • Hide

      Set breakpoints in:

      • org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList#registerInterposedSynchronization
      • org.jboss.as.txn.service.internal.tsr.#registerInterposedSynchronization

      change into wildfly/testsuite/integration/basic and do "mvn clean install -Dtest=org.jboss.as.test.integration.jpa.transaction.TransactionTestCase"

      Show
      Set breakpoints in: org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList#registerInterposedSynchronization org.jboss.as.txn.service.internal.tsr.#registerInterposedSynchronization change into wildfly/testsuite/integration/basic and do "mvn clean install -Dtest=org.jboss.as.test.integration.jpa.transaction.TransactionTestCase"

      JPA container synchronizations are not registered via JCAOrderedLastSynchronizationList, which means that JCA Synchronization#afterCompletion will not always run after JPA Synchronization#afterCompletion.

      Apparently we are doing a JNDI lookup of "java:jboss/TransactionSynchronizationRegistry" for Hibernate ORM integration, which means we are using the org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper for Hibernate ORM. Should we also be using the org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper class in other WildFly call sites, instead of org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry?

      Call stack below shows the JPA container sync not being registered via JCAOrderedLastSynchronizationList:

      10:48:42,859 ERROR [stderr] (pool-7-thread-7)   at java.lang.Thread.dumpStack(Thread.java:1336)
      10:48:42,865 ERROR [stderr] (pool-7-thread-7)   at org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry.registerInterposedSynchronization(ContextTransactionSynchronizationRegistry.java:77)
      10:48:42,866 ERROR [stderr] (pool-7-thread-7)   at org.jboss.as.jpa.transaction.TransactionUtil.registerSynchronization(TransactionUtil.java:74)
      10:48:42,866 ERROR [stderr] (pool-7-thread-7)   at org.jboss.as.jpa.container.TransactionScopedEntityManager.getOrCreateTransactionScopedEntityManager(TransactionScopedEntityManager.java:162)
      10:48:42,867 ERROR [stderr] (pool-7-thread-7)   at org.jboss.as.jpa.container.TransactionScopedEntityManager.getEntityManager(TransactionScopedEntityManager.java:87)
      10:48:42,867 ERROR [stderr] (pool-7-thread-7)   at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
      10:48:42,867 ERROR [stderr] (pool-7-thread-7)   at org.jboss.as.test.integration.jpa.transaction.UnsynchronizedSFSB.createAndPropagatedFindMixExceptionExcepted(UnsynchronizedSFSB.java:88)
      

      Call stack below shows the JCA synchronization is also NOT registered correctly via JCAOrderedLastSynchronizationList:

      10:45:06,979 ERROR [stderr] (pool-7-thread-8) java.lang.Exception: Stack trace
      10:45:06,980 ERROR [stderr] (pool-7-thread-8)   at java.lang.Thread.dumpStack(Thread.java:1336)
      10:45:06,980 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.<init>(SynchronizationImple.java:57)
      10:45:06,980 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.provider.jboss.JBossJTALocalTransactionProvider.registerInterposedSynchronization(JBossJTALocalTransactionProvider.java:87)
      10:45:06,981 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.LocalTransaction.registerInterposedSynchronization(LocalTransaction.java:202)
      10:45:06,981 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry.registerInterposedSynchronization(ContextTransactionSynchronizationRegistry.java:77)
      10:45:06,981 ERROR [stderr] (pool-7-thread-8)   at org.jboss.jca.core.connectionmanager.transaction.TransactionSynchronizer.lock(TransactionSynchronizer.java:309)
      10:45:06,981 ERROR [stderr] (pool-7-thread-8)   at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:311)
      10:45:06,982 ERROR [stderr] (pool-7-thread-8)   at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:564)
      10:45:06,982 ERROR [stderr] (pool-7-thread-8)   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:970)
      10:45:06,982 ERROR [stderr] (pool-7-thread-8)   at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:792)
      10:45:06,982 ERROR [stderr] (pool-7-thread-8)   at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)
      10:45:06,983 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:64)
      10:45:06,983 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
      10:45:06,983 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:35)
      10:45:06,983 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:106)
      10:45:06,984 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:136)
      10:45:06,984 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)
      10:45:06,984 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:87)
      10:45:06,984 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
      10:45:06,984 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:78)
      10:45:06,984 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3152)
      10:45:06,985 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3686)
      10:45:06,985 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90)
      10:45:06,985 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
      10:45:06,985 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:478)
      10:45:06,985 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356)
      10:45:06,985 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
      10:45:06,986 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1454)
      10:45:06,986 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:511)
      10:45:06,986 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3283)
      10:45:06,986 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2479)
      10:45:06,986 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:473)
      10:45:06,987 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.beforeCompletion(JtaTransactionCoordinatorImpl.java:352)
      10:45:06,987 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.resource.transaction.backend.jta.internal.synchronization.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:47)
      10:45:06,987 ERROR [stderr] (pool-7-thread-8)   at org.hibernate.resource.transaction.backend.jta.internal.synchronization.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:37)
      10:45:06,987 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.beforeCompletion(JCAOrderedLastSynchronizationList.java:113)
      10:45:06,987 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.AbstractTransaction.performConsumer(AbstractTransaction.java:236)
      10:45:06,988 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.AbstractTransaction.performConsumer(AbstractTransaction.java:247)
      10:45:06,988 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.AbstractTransaction$AssociatingSynchronization.beforeCompletion(AbstractTransaction.java:292)
      10:45:06,988 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
      10:45:06,988 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:360)
      10:45:06,988 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
      10:45:06,988 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
      10:45:06,989 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1288)
      10:45:06,989 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
      10:45:06,989 ERROR [stderr] (pool-7-thread-8)   at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:89)
      10:45:06,989 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.LocalTransaction.commitAndDissociate(LocalTransaction.java:77)
      10:45:06,989 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.ContextTransactionManager.commit(ContextTransactionManager.java:71)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at org.wildfly.transaction.client.LocalUserTransaction.commit(LocalUserTransaction.java:53)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.test.integration.jpa.transaction.SFSB1.createEmployee(SFSB1.java:96)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at java.lang.reflect.Method.invoke(Method.java:498)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
      10:45:06,990 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:90)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:101)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
      10:45:06,991 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.jpa.interceptor.SFSBInvocationInterceptor.processInvocation(SFSBInvocationInterceptor.java:57)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.ejb3.tx.StatefulBMTInterceptor.handleInvocation(StatefulBMTInterceptor.java:94)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:58)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
      10:45:06,992 ERROR [stderr] (pool-7-thread-8)   at org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:137)
      

      Lastly, the following call stack shows the Hibernate ORM sync being correctly registered via JCAOrderedLastSynchronizationList:

      10:52:20,820 ERROR [stderr] (pool-7-thread-1) java.lang.Exception: Stack trace
      10:52:20,821 ERROR [stderr] (pool-7-thread-1)   at java.lang.Thread.dumpStack(Thread.java:1336)
      10:52:20,821 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.registerInterposedSynchronization(JCAOrderedLastSynchronizationList.java:64)
      10:52:20,821 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper.registerInterposedSynchronization(TransactionSynchronizationRegistryWrapper.java:76)
      10:52:20,821 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.jpa.hibernate5.service.WildFlyCustomJtaPlatform$1.registerSynchronization(WildFlyCustomJtaPlatform.java:45)
      10:52:20,822 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform.registerSynchronization(AbstractJtaPlatform.java:126)
      10:52:20,822 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.joinJtaTransaction(JtaTransactionCoordinatorImpl.java:170)
      10:52:20,822 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.pulse(JtaTransactionCoordinatorImpl.java:158)
      10:52:20,822 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl.<init>(JtaTransactionCoordinatorImpl.java:94)
      10:52:20,822 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl.buildTransactionCoordinator(JtaTransactionCoordinatorBuilderImpl.java:29)
      10:52:20,822 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.AbstractSharedSessionContract.<init>(AbstractSharedSessionContract.java:204)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.AbstractSessionImpl.<init>(AbstractSessionImpl.java:29)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:254)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1290)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.SessionFactoryImpl.buildEntityManager(SessionFactoryImpl.java:628)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.SessionFactoryImpl.createEntityManager(SessionFactoryImpl.java:614)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.hibernate.internal.SessionFactoryImpl.createEntityManager(SessionFactoryImpl.java:154)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.jpa.container.TransactionScopedEntityManager.createEntityManager(TransactionScopedEntityManager.java:187)
      10:52:20,823 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.jpa.container.TransactionScopedEntityManager.getOrCreateTransactionScopedEntityManager(TransactionScopedEntityManager.java:157)
      10:52:20,824 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.jpa.container.TransactionScopedEntityManager.getEntityManager(TransactionScopedEntityManager.java:87)
      10:52:20,824 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.jpa.container.AbstractEntityManager.joinTransaction(AbstractEntityManager.java:536)
      10:52:20,824 ERROR [stderr] (pool-7-thread-1)   at org.jboss.as.test.integration.jpa.transaction.SFSB1.createEmployee(SFSB1.java:93)
      
      

              bstansbe@redhat.com Brian Stansberry
              smarlow1@redhat.com Scott Marlow
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: