Process will not end...leads to heap error

HI folks. I have a flow that I made in modeler. I run it, and I have a final task that writes to the console “FLOW FINISHED AT XX:XX” I can clearly see that the flow is completed. However, when I look in cockpit, the flow is still running. In VisualVM I can see that the memory is slowly ticking up and eventually I will get a heap error. How do I make this quit properly? The flow is running with the proper start/end events. Would changing the end event to a terminate end event be better or something?

Can you upload the model?

It’s pretty big and has some company stuff in it…that might be rather difficult. Is there something else I could do to get the information you require? Would a better explanation of the steps that the flow goes through help?

If you can create a way of replicating the problem in a smaller process that might help.
Other than that it’s gonna be very hard to help.

Here’s a scrubbed version
AoNotification.bpmn (200.9 KB)

Can you give some details about your setup, camunda version, deployment etc?

I"m running 2.2.4. For the setup, I’ve got the following memory arguments:
-DAJSCARGS= -Xms768m -Xmx768m -XX:MetaspaceSize=64m -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode

At present, this is being run off my desktop, running from eclipse.

Also - i see that you have a lot of scripts running and you don’t have a lot of transaction boundaries so a lot of things are running in a same thread which means the thread could time out before it finishes everything. I’d defiantly suggest you add more transaction boundaries.

What do you mean? The script boxes? I thought that they were running serially. How do I fix this?

They’re running one after another, but they’re all running in the same thread without a break, which might cause a timeout an rollback.
You can read more about how transaction work in the docs.

Is that why in the runtime I only see the variables passed from postman and nothing else?

Oh, I didn’t have any rollback issues if that helps.

I have tried a few things, but right now I’m trying to process 12k records, and it pulls in chunks of 5000. When it does this, as I said, it finishes and continues to tick up.

Try adding some transaction boundaries before you run a load of scripts by using the Asynchronous Before tick box on some tasks. See if that solves the problem

Ok I’ll try that now. What about the memory issue?

@iscariot_TF Memory issue will be resolved either by increasing heap size if you decide to execute the process in same thread otherwise setting transaction boundaries as asyncBefore=true on activity will flush the in-memory process execution data, so memory will be released for further execution.

Increasing heap will be like adhoc solution. So best practice is to add transaction boundaries to flush the process execution data which has benefits like :

  • Easy to rollback,
  • Memory issue will be resolved
  • Timeout issue will be resolved, etc
2 Likes

OK. I can add the async before stuff and test. I can’t really increase heap size. Are there particular script boxes I should make asynchronous before?

@iscariot_TF you can find the option in properties panel like below.

Thank you. I found it, does it matter what boxes I put that on? I tried it and I’m watching it run right now in VisualVM and the memory is certainly lower.

@iscariot_TF, here’s simple picture to explain about transaction boundaries(save point) for the above use case. Adding transaction boundaries has another great feature is if process fails at any step it can be continued from that activity only, not from the beginning of the start event. This is not possible when you execute the entire process in same thread.

Tx1 data will be flushed to database before processing the Tx2. So the amount of data in the memory would be less when compared to execution in single thread model.

TX1, TX2, TX3 are called as transaction boundaries or save points.

2 Likes