Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-10819

Message Correlation throws an exception "Cannot add TRANSIENT" with localVariables

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.12.0, 7.12.0-alpha5
    • Component/s: engine
    • Labels:
      None

      Description

      Hi guys
      I have a process definition that starts with a Message Start Event. When I try to set a localVariable invoking the runtimeService.createMessageCorrelation an exception is thrown. Example;

      A simple flow like:

      Works fine when I set a global variable using setVariable but fails when I invoke the code with setVariableLocal:

      runtimeService?.createMessageCorrelation("START_EVENT")?.
                          processInstanceBusinessKey("XPTO-001")?.
                          setVariableLocal("local-var", "Some Message")?.
                          correlateWithResult()
      

      The exception is:

      org.camunda.bpm.engine.ProcessEngineException: ENGINE-03002 Cannot add TRANSIENT entity with id '4ae7a392-d552-11e9-810b-ea553ab1b917' and type 'class org.camunda.bpm.engine.impl.persistence.entity.HistoricVariableInstanceEntity' into cache. An entity with the same id and type is already in state 'TRANSIENT'
      	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.entityCacheDuplicateEntryException(EnginePersistenceLogger.java:98) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.db.entitymanager.cache.DbEntityCache.putInternal(DbEntityCache.java:210) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.db.entitymanager.cache.DbEntityCache.putTransient(DbEntityCache.java:154) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.insert(DbEntityManager.java:575) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler.insertHistoricVariableUpdateEntity(DbHistoryEventHandler.java:114) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler.handleEvent(DbHistoryEventHandler.java:45) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler.handleEvent(CompositeHistoryEventHandler.java:96) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor.processHistoryEvents(HistoryEventProcessor.java:75) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceHistoryListener.onCreate(VariableInstanceHistoryListener.java:39) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.fireHistoricVariableInstanceCreateEvents(ExecutionEntity.java:1297) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext.executionStarted(ExecutionStartContext.java:49) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStart.eventNotificationsCompleted(PvmAtomicOperationActivityStart.java:36) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStart.eventNotificationsCompleted(PvmAtomicOperationActivityStart.java:28) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:66) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:108) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:73) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:649) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:624) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:62) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:108) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:73) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:649) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:624) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:62) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:108) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:73) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:649) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:624) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:62) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:108) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:640) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:614) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCreateScope.scopeCreated(PvmAtomicOperationActivityStartCreateScope.java:43) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:54) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:28) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:115) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext$1.call(CommandInvocationContext.java:99) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext$1.call(CommandInvocationContext.java:97) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:48) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:121) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:132) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:195) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:97) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:640) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:614) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.start(PvmExecutionImpl.java:248) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.start(ExecutionEntity.java:449) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.cmd.AbstractCorrelateMessageCmd.instantiateProcess(AbstractCorrelateMessageCmd.java:83) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.cmd.AbstractCorrelateMessageCmd.createMessageCorrelationResult(AbstractCorrelateMessageCmd.java:113) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd.execute(CorrelateMessageCmd.java:95) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd.execute(CorrelateMessageCmd.java:42) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:107) ~[camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:46) [camunda-engine-spring-7.11.0.jar:7.11.0]
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) [spring-tx-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:44) [camunda-engine-spring-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.MessageCorrelationBuilderImpl.execute(MessageCorrelationBuilderImpl.java:313) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.impl.MessageCorrelationBuilderImpl.correlateWithResult(MessageCorrelationBuilderImpl.java:224) [camunda-engine-7.11.0.jar:7.11.0]
      	at abner.report.bugs.camunda.FlowDeployListener.notify(FlowDeployListener.kt:20) [classes/:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
      	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:261) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:179) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:142) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:372) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.camunda.bpm.spring.boot.starter.SpringBootProcessApplication.onPostDeploy(SpringBootProcessApplication.java:112) [camunda-bpm-spring-boot-starter-3.3.4.jar:3.3.4]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
      	at org.camunda.bpm.container.impl.deployment.PostDeployInvocationStep.performOperationStep(PostDeployInvocationStep.java:68) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:120) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.container.impl.jmx.MBeanServiceContainer.executeDeploymentOperation(MBeanServiceContainer.java:160) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.container.impl.spi.DeploymentOperation$DeploymentOperationBuilder.execute(DeploymentOperation.java:216) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.container.impl.RuntimeContainerDelegateImpl.deployProcessApplication(RuntimeContainerDelegateImpl.java:102) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.application.AbstractProcessApplication.deploy(AbstractProcessApplication.java:66) [camunda-engine-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.spring.application.SpringProcessApplication.start(SpringProcessApplication.java:110) [camunda-engine-spring-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.spring.application.SpringProcessApplication.afterPropertiesSet(SpringProcessApplication.java:119) [camunda-engine-spring-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.spring.boot.starter.SpringBootProcessApplication.afterPropertiesSet(SpringBootProcessApplication.java:101) [camunda-bpm-spring-boot-starter-3.3.4.jar:3.3.4]
      	at org.camunda.bpm.engine.spring.application.SpringProcessApplication.onApplicationEvent(SpringProcessApplication.java:96) [camunda-engine-spring-7.11.0.jar:7.11.0]
      	at org.camunda.bpm.engine.spring.application.SpringProcessApplication.onApplicationEvent(SpringProcessApplication.java:52) [camunda-engine-spring-7.11.0.jar:7.11.0]
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:896) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) [spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE]
      	at abner.report.bugs.camunda.ApplicationKt.main(Application.kt:13) [classes/:na]
      

      You can replicate the error using the code here:

        Attachments

        1. process_definition.png
          31 kB
          Abner Luis Santos Rolim

          Issue Links

            Activity

              People

              Assignee:
              thorben.lindhauer Thorben Lindhauer
              Reporter:
              abnerrolim Abner Luis Santos Rolim
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: