Out of memory issue in Task Thread

Hi Caumnda Team,

While starting a process instance, we are getting out of memory error.
java.lang.OutOfMemoryError: Java heap space

we are using below versions:

Spring-Boot: (v2.1.5.RELEASE)
Camunda BPM: (v7.11.0)
Camunda BPM Spring Boot Starter: (v3.3.2).

I am having heap dump of the issue which is showing performedInvocations in BpmnStackTrace is holding 350MB of retained heap memory. which all is having AtomicOperationInvocation.

I am not getting exactly what is happening because it was working previously and just getting corrupted now. We just have deployed 2 more process Definitions on the server.

Details Stack Trace of the Issue

null
at org.springframework.context.PayloadApplicationEvent.getResolvableType()Lorg/springframework/core/ResolvableType; (PayloadApplicationEvent.java:52)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(Ljava/lang/Object;Lorg/springframework/core/ResolvableType;)V (AbstractApplicationContext.java:393)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(Ljava/lang/Object;)V (AbstractApplicationContext.java:372)
at org.camunda.bpm.spring.boot.starter.event.PublishDelegateParseListener.lambda$new$1(Lorg/camunda/bpm/spring/boot/starter/property/EventingProperty;Lorg/springframework/context/ApplicationEventPublisher;Lorg/camunda/bpm/engine/delegate/DelegateExecution;)V (PublishDelegateParseListener.java:65)
at org.camunda.bpm.spring.boot.starter.event.PublishDelegateParseListener$$Lambda$565.notify(Lorg/camunda/bpm/engine/delegate/BaseDelegateExecution;)V (Unknown Source)
at org.camunda.bpm.engine.impl.core.instance.CoreExecution.invokeListener(Lorg/camunda/bpm/engine/delegate/DelegateListener;)V (CoreExecution.java:101)
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(Lorg/camunda/bpm/engine/impl/core/instance/CoreExecution;)V (AbstractEventAtomicOperation.java:55)
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(Lorg/camunda/bpm/engine/impl/interceptor/BpmnStackTrace;)V (AtomicOperationInvocation.java:96)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext()V (CommandInvocationContext.java:128)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext()V (CommandInvocationContext.java:115)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(Lorg/camunda/bpm/engine/impl/pvm/runtime/AtomicOperation;Lorg/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity;Z)V (CommandInvocationContext.java:83)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(Lorg/camunda/bpm/engine/impl/pvm/runtime/AtomicOperation;)V (ExecutionEntity.java:640)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(Lorg/camunda/bpm/engine/impl/core/operation/CoreAtomicOperation;)V (ExecutionEntity.java:614)
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.start(Ljava/util/Map;)V (PvmExecutionImpl.java:248)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.start(Ljava/util/Map;)V (ExecutionEntity.java:449)
at org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(Lorg/camunda/bpm/engine/impl/interceptor/CommandContext;)Lorg/camunda/bpm/engine/runtime/ProcessInstanceWithVariables; (StartProcessInstanceCmd.java:66)
at org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(Lorg/camunda/bpm/engine/impl/interceptor/CommandContext;)Ljava/lang/Object; (StartProcessInstanceCmd.java:38)

Please explain what you do to cause this error and if you could upload your model that would also be helpful.

Model which I deployed on the environment.
Koko_Process_V1.bpmn (14.8 KB)

This is heap dump stack list object.

When I am trying to start process Instance it’s giving me out of memory for any of the process.

application.txt (1.0 KB)
Configuration

Does the error happen when your deploy it? when you start it?
When a specific path is executed?

When I am trying to start my process, this issue is happening

Does it happen irrelevant of the payload - i.e. if the result variable is NO or YES

It doesn’t related to that. Because same process is working on different environment.

What other environment does it work in?

Like we are having Dev, ST environment.
It’s working on ST. Although the load on ST is more than the load at Dev environment.
But ST is having a bigger environment than Dev.

But still it shouldn’t happen.

Anything can I check from my side in between.
The environment is totally stuck because of this issue.

This is something very hard to diagnose.
I suspect it’s the client code that you have running that might be causing the issue. the engine wouldn’t really need anywhere near that kind of resource - so i suggest running measurable tests against the client code

I am just starting the process Instance on camunda with single variable in the request which I was doing multiple time. Nothing else I performed.

What does the code behind updateFlowTask do?

I’ve run the model without any problems at all.
Is there anything about the engine’s config that you’ve changed?

Nothing I have changed. I attached my configuration earlier. That was the only one I am using. And regarding updateFlowTask it’s just a delegate which is calling another service through rest endpoint. But it is not getting called in the starting.