Memory Leak After Camunda Update to 7.23

I had to update an older Camunda to 7.23 and now we have a memory leak.

We are using the spring boot starter for 7.23 with graal vm js-scriptengine 24.2.1 (switched from nashorn). Here you can see the heap dump:

 num     #instances         #bytes  class name (module)
-------------------------------------------------------
   1:       3024866      120828384  [Ljava.lang.Object; (java.base@21.0.7)
   2:       2539377      101575080  com.oracle.truffle.js.runtime.builtins.JSFunctionObject$Unbound
   3:         20788       66902256  [C (java.base@21.0.7)
   4:        437158       58138952  [B (java.base@21.0.7)
   5:       1054702       25312848  com.oracle.truffle.host.HostObject
   6:        349596       22374144  com.oracle.truffle.js.runtime.objects.JSOrdinaryObject$DefaultLayout
   7:        302327       19348928  com.oracle.truffle.api.frame.FrameDescriptor

The processes are executed thousands of times a day and they all contain many Business rule tasks with JS end execution listeners like so (that’s basically all the JS in the processes):

var res = execution.getVariable('decisionResult').getSingleResult();
var dto = execution.getVariable('dto');
dto.setFoo(res)

The values 1 and 2 in the heap dump are very slowly getting bigger until the heap gets out of memory, it takes about 24 hours with thousands of processes executed per day.

Any idea how this can be fixed?

I think it should be analyzed first (by you). Then it can be fixed. Another way would be to force the application restart every so many hours so that the memory limit does not get hit.

Another way would be to force the application restart every so many hours so that the memory limit does not get hit.

Yes, I already did that, but this is no solution, just a workaround. What exactly do you want me to analyze? I think I’ve already shown that there is a bug with GraalVM or Camunda is using GraalVM incorrectly which leads to the memory leak.

It worked with nashorn, but we didn’t get to run Camunda with it. And with GraalVM we get the memory leak.