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

StatefulSessionSynchronizationInterceptor fails weirdly if the transaction is in ROLLBACK_ONLY

    Details

      Description

      It's not really clear what the correct behavior is, but it definitely isn't this:

      2017-04-07 14:53:09 javax.ejb.EJBTransactionRolledbackException: WFLYTX0029: Syncs are not allowed to be registered when the tx is in state 1
      2017-04-07 14:53:09     at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:160)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:257)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:334)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:327)
      2017-04-07 14:53:09     at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:73)
      2017-04-07 14:53:09     at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:89)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:84)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.deployment.processors.EjbSuspendInterceptor.processInvocation(EjbSuspendInterceptor.java:57)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:60)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:256)
      2017-04-07 14:53:09     at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:609)
      2017-04-07 14:53:09     at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:57)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
      2017-04-07 14:53:09     at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)
      2017-04-07 14:53:09     at org.wildfly.security.auth.server.SecurityIdentity.runAsFunctionEx(SecurityIdentity.java:380)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.remote.AssociationImpl.invokeWithIdentity(AssociationImpl.java:457)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.remote.AssociationImpl.invokeMethod(AssociationImpl.java:452)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.remote.AssociationImpl.lambda$receiveInvocationRequest$0(AssociationImpl.java:164)
      2017-04-07 14:53:09     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2017-04-07 14:53:09     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2017-04-07 14:53:09     at java.lang.Thread.run(Thread.java:745)
      2017-04-07 14:53:09 Caused by: java.lang.IllegalStateException: WFLYTX0029: Syncs are not allowed to be registered when the tx is in state 1
      2017-04-07 14:53:09     at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.registerInterposedSynchronization(JCAOrderedLastSynchronizationList.java:76)
      2017-04-07 14:53:09     at org.jboss.as.txn.service.internal.tsr.TransactionSynchronizationRegistryWrapper.registerInterposedSynchronization(TransactionSynchronizationRegistryWrapper.java:78)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:118)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:40)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:53)
      2017-04-07 14:53:09     at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:59)
      2017-04-07 14:53:09     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:240)
      2017-04-07 14:53:09     at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:255)
      2017-04-07 14:53:09     ... 42 more
      

      If the transaction is in ROLLBACK_ONLY, then any of these might possibly be correct behavior:

      • Reject the invocation with a specific exception explaining that the method cannot be invoked when the transaction is in ROLLBACK_ONLY (preferably with a spec citation)
      • Allow the invocation to proceed without registering the synchronization (this probably isn't correct but might be)
      • Allow the invocation to proceed and use a "backdoor" to register the user synchronization anyway

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dmlloyd David Lloyd
                Reporter:
                dmlloyd David Lloyd
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: