Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-3540

Persisting new entity with cached blind-side @OneToMany CMR field fails on transaction flush to ARJUNA016082.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • None
    • 5.2.1.Final, 6.0.0.CR1
    • Integration
    • None

    Description

      I have two entity beans, both transactionally cached and then n:m relationship between them. The one side maps the CMR relationship as a Set and sets it to be transactionally cached.

      Now when I create a new object on the one side, so that the Set containing the other side is empty, the transaction fails during the flush stage with the following message:

      WARN [org.infinispan.transaction.TransactionTable] (http-/0.0.0.0:8080-1 ISPN000101: Failed synchronization registration: java.lang.IllegalStateException: ARJUNA016082: Synchronizations are not allowed! Transaction status isActionStatus.RUNNING

      If I leave the Set field null, it works.

      The beans:

      @Entity()
      @Table(name="k3_run")
      @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
      public class Run implements Serializable {

      private Integer id;

      private Set<Restriction> restrictions = new HashSet<>();

      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name = "id")
      public Integer getId()

      { return id; }

      public void setId(Integer id) { this.id = id; }

      @OneToMany
      @JoinColumn(name="run_fk")
      @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
      public Set<Restriction> getRestrictions() { return restrictions; }

      public void setRestrictions(Set<Restriction> restrictions) { this.restrictions = restrictions; }
      }


      @Entity
      @Table(name="k3_restriction")
      @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL)
      public class Restriction {
      private Integer id;

      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name = "id")
      public Integer getId() { return id; }

      public void setId(Integer id)

      { this.id = id; }

      }

      The RESTeasy service doing the creation:
      @Stateless
      @LocalBean
      @Path("/bug_repro")
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      public class RunRest {
      @PersistenceContext(unitName = "persistence_context")
      protected EntityManager entityManager;

      @POST
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      public String createRun()

      { final Run run = new Run(); entityManager.persist(run); return "New run created with ID " + run.getId(); }

      }

      This curl command used to invoke it:
      curl -H 'Content-Type: application/xml; charset=UTF-8' -X POST http://localhost:8080/infinispan_bug_reproduction/bug_repro

      The persistence.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
      version="2.0">
      <persistence-unit name="persistence_context" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/OperationalDS</jta-data-source>
      <properties>
      <property name="hibernate.hbm2ddl.auto" value="validate"/>
      <property name="hibernate.cache.use_second_level_cache" value="true"/>
      <property name="hibernate.cache.use_query_cache" value="true"/>
      </properties>
      </persistence-unit>
      </persistence>

      The datasource definition:
      <xa-datasource jndi-name="java:/OperationalDS" pool-name="MpkDemoUsDS" enabled="true">
      <xa-datasource-property name="ServerName">
      localhost
      </xa-datasource-property>
      <xa-datasource-property name="DatabaseName">
      production
      </xa-datasource-property>
      <driver>mysql</driver>
      <security>
      <user-name>k3</user-name>
      <password>********</password>
      </security>
      <validation>
      <check-valid-connection-sql>/* ping */ SELECT 1</check-valid-connection-sql>
      <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
      </validation>
      </xa-datasource>

      The stacktrace:

      17:08:50,159 WARN [org.infinispan.transaction.TransactionTable] (http-/0.0.0.0:8080-1 ISPN000101: Failed synchronization registration: java.lang.IllegalStateException: ARJUNA016082: Synchronizations are not allowed! Transaction status isActionStatus.RUNNING
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.registerSynchronizationImple(TransactionImple.java:374)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.registerSynchronization(TransactionImple.java:351)
      at org.infinispan.transaction.TransactionTable.enlist(TransactionTable.java:214)
      at org.infinispan.interceptors.TxInterceptor.enlist(TxInterceptor.java:271)
      at org.infinispan.interceptors.TxInterceptor.enlistWriteAndInvokeNext(TxInterceptor.java:245)
      at org.infinispan.interceptors.TxInterceptor.visitRemoveCommand(TxInterceptor.java:201)
      at org.infinispan.commands.write.RemoveCommand.acceptVisitor(RemoveCommand.java:72)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.CacheMgmtInterceptor.visitRemoveCommand(CacheMgmtInterceptor.java:137)
      at org.infinispan.commands.write.RemoveCommand.acceptVisitor(RemoveCommand.java:72)
      at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:118)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:128)
      at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:92)
      at org.infinispan.commands.AbstractVisitor.visitRemoveCommand(AbstractVisitor.java:67)
      at org.infinispan.commands.write.RemoveCommand.acceptVisitor(RemoveCommand.java:72)
      at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:343)
      at org.infinispan.CacheImpl.executeCommandAndCommitIfNeeded(CacheImpl.java:1162)
      at org.infinispan.CacheImpl.removeInternal(CacheImpl.java:308)
      at org.infinispan.CacheImpl.remove(CacheImpl.java:302)
      at org.infinispan.DecoratedCache.remove(DecoratedCache.java:325)
      at org.infinispan.AbstractDelegatingCache.remove(AbstractDelegatingCache.java:313)
      at org.hibernate.cache.infinispan.access.TransactionalAccessDelegate.remove(TransactionalAccessDelegate.java:152) [hibernate-infinispan-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.cache.infinispan.collection.TransactionalAccess.remove(TransactionalAccess.java:48) [hibernate-infinispan-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.action.internal.CollectionAction.evict(CollectionAction.java:152) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:64) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:292) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:113) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.2.4.Final.jar:4.2.4.Final]
      at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
      at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
      at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
      at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)
      at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:91) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:252) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:315) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54) [jboss-as-ejb3-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) [jboss-as-ee-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.2.0.Final.jar:7.2.0.Final]
      at com.ecolane.mpk.rest.RunRest$$$view2.createRun(Unknown Source) [classes:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_40]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_40]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_40]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_40]
      at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.5.Final.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]

      Attachments

        Activity

          People

            rh-ee-galder Galder ZamarreƱo
            zds_jira Jari Juslin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: