Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Query service] EntityExistsException when executing a process with cycles #3886

Closed
erdemedeiros opened this issue Mar 22, 2022 · 0 comments · Fixed by Activiti/activiti-cloud#649
Labels
Milestone

Comments

@erdemedeiros
Copy link
Member

erdemedeiros commented Mar 22, 2022

When executing a process that contains a cycle, an exception occurs in query service the second time the task is reached:

image

2022-03-22 09:32:01.792 ERROR [query,5028b105dce87ae9,c52290d99727fccb] 7 --- [eEvents.query-1] o.s.integration.handler.LoggingHandler   : org.springframework.messaging.MessagingException: Exception thrown while invoking QueryConsumerChannelHandler#receive[1 args]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [org.activiti.cloud.services.query.model.IntegrationContextEntity#64c3b6d9-a9c2-11ec-bf52-aa11a2095e9d:ServiceTask_1qot7s2:64c3b6db-a9c2-11ec-bf52-aa11a2095e9d], failedMessage=GenericMessage [payload=byte[87735], headers={serviceType=runtime-bundle, amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedExchange=engineEvents, amqp_deliveryTag=21, rootProcessDefinitionKey=Process_skZEn0kcz, amqp_redelivered=false, serviceVersion=, b3=5028b105dce87ae9-d745cfbc897d5d09-1, messagePayloadType=[Lorg.activiti.cloud.api.model.shared.events.CloudRuntimeEvent;, rootProcessDefinitionVersion=1, deploymentId=b617669a-a9be-11ec-bf52-aa11a2095e9d, rootProcessInstanceId=64c3b6d9-a9c2-11ec-bf52-aa11a2095e9d, deploymentName=SpringAutoDeployment, id=23c730c8-a6c6-9664-3c16-7a14228bab8b, sourceData=(Body:'[B@1deab18c(byte[87735])' MessageProperties [headers={serviceType=runtime-bundle, serviceFullName=rb, appName=test-m17, deploymentVersion=1, rootProcessDefinitionKey=Process_skZEn0kcz, serviceName=rb, serviceVersion=, rootProcessDefinitionId=Process_skZEn0kcz:1:b6223c0d-a9be-11ec-bf52-aa11a2095e9d, b3=5028b105dce87ae9-2b32372af29a214c-1, nativeHeaders={}, messagePayloadType=[Lorg.activiti.cloud.api.model.shared.events.CloudRuntimeEvent;, rootProcessDefinitionVersion=1, deploymentId=b617669a-a9be-11ec-bf52-aa11a2095e9d, rootProcessDefinitionName=tomegkoz-tam-public-transp, rootProcessInstanceId=64c3b6d9-a9c2-11ec-bf52-aa11a2095e9d, deploymentName=SpringAutoDeployment, routingKey=engineEvents.rb.test-m17, rootProcessName=tomegkoz-tam-public-transp - Mar 22, 2022, 9:28:11 AM}, timestamp=Tue Mar 22
09:31:58 UTC 2022, messageId=81dadf1c-22d6-b988-6bcf-d38c07706abe, contentType=application/json, contentLength=0, receivedDeliveryMode=PERSISTENT, priority=0, redelivered=false, receivedExchange=engineEvents, receivedRoutingKey=engineEvents, deliveryTag=21, consumerTag=amq.ctag-DdgH84Dny9mI13CLJ4ENGw, consumerQueue=engineEvents.query]), contentType=application/json, timestamp=1647941521743, serviceFullName=rb, appName=test-m17, deploymentVersion=1, deliveryAttempt=3, amqp_consumerQueue=engineEvents.query, serviceName=rb, amqp_receivedRoutingKey=engineEvents, rootProcessDefinitionId=Process_skZEn0kcz:1:b6223c0d-a9be-11ec-bf52-aa11a2095e9d, nativeHeaders={}, amqp_timestamp=Tue Mar 22 09:31:58 UTC 2022, amqp_messageId=81dadf1c-22d6-b988-6bcf-d38c07706abe, rootProcessDefinitionName=tomegkoz-tam-public-transp, amqp_consumerTag=amq.ctag-DdgH84Dny9mI13CLJ4ENGw, routingKey=engineEvents.rb.test-m17, rootProcessName=tomegkoz-tam-public-transp - Mar 22, 2022, 9:28:11 AM}]
	at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:64)
	at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:136)
	at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:56)
	at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
	at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:133)
	at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:106)
	at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72)
	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:317)
	at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:272)
	at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
	at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)
	at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
	at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109)
	at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:208)
	at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$1300(AmqpInboundChannelAdapter.java:69)
	at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.lambda$onMessage$0(AmqpInboundChannelAdapter.java:374)
	at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:329)
	at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:225)
	at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.onMessage(AmqpInboundChannelAdapter.java:370)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1665)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1584)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1572)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1563)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1507)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:967)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:914)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:83)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1291)
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1197)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [org.activiti.cloud.services.query.model.IntegrationContextEntity#64c3b6d9-a9c2-11ec-bf52-aa11a2095e9d:ServiceTask_1qot7s2:64c3b6db-a9c2-11ec-bf52-aa11a2095e9d]
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:123)
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:766)
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:746)
	at jdk.internal.reflect.GeneratedMethodAccessor165.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:311)
	at com.sun.proxy.$Proxy270.persist(Unknown Source)
	at org.activiti.cloud.services.query.events.handlers.IntegrationRequestedEventHandler.handle(IntegrationRequestedEventHandler.java:69)
	at org.activiti.cloud.services.query.events.handlers.QueryEventHandlerContext.lambda$handle$0(QueryEventHandlerContext.java:47)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
	at org.activiti.cloud.services.query.events.handlers.QueryEventHandlerContext.handle(QueryEventHandlerContext.java:42)
	at org.activiti.cloud.services.query.app.QueryConsumerChannelHandler.receive(QueryConsumerChannelHandler.java:41)
	at org.activiti.cloud.services.query.app.QueryConsumerChannelHandler$$FastClassBySpringCGLIB$$80c8bb00.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
	at org.activiti.cloud.services.query.app.QueryConsumerChannelHandler$$EnhancerBySpringCGLIB$$889b7dee.receive(<generated>)
	at jdk.internal.reflect.GeneratedMethodAccessor411.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:169)
	at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:119)
	at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55)
	... 29 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant