OOM error and incoherent datas in DB

Hi everyone,

I know the title of this topic is not that clear but let me explain out.

We have an application that is using Flowable 6.8.0.

We had an out of memory error on our app. Our app has been killed directly.

But we realized that after this crash, some of the process instances that we had (and still have) were stucked.

We looked into the database and we realized that for a given process instance with id = 487027953
we have some activity instances with act_type=‘serviceTask’ in the tables act_hi_actinst or act_hi_actinst that have an endTime set to null.

From my point of view, there was no problem here.

So I tried to find any job related to this activity instance in act_ru_job, act_ru_deadletter_job, act_ru_timer_job but I did find nothing…

So I then created a new line into act_ru_job to make the process instance go forward and apparently it did.

We have some of our process instances that are like this.

Apart from this, we are not doing anything else of activity instances table.

We are not able to reproduce this problem.

In the code of Flowable we have found this :

    protected ActivityInstance recordActivityInstanceEnd(ExecutionEntity executionEntity, String deleteReason) {

        // It is possible that we record the activity instance end twice,
        // which could lead to having no finished activity instance in the DB.
        // if there is a finished runtime one, we should use the runtime one.
        // It is also OK for pre activity instances (when the runtime activities were added).
        // Since the first time we go through here we won't find anything in the cache and the DB,
        // so we will create one from the history (this will add one to the cache).
        // The second time we go through here, there will be nothing in the DB, but one finished one in the cache.
        // This one should be used, in order to avoid going to the historic tables again.

        ActivityInstanceEntity activityInstance = findUnfinishedActivityInstance(executionEntity, true);
        if (activityInstance != null) {
            if (activityInstance.getEndTime() == null) {

        } else {
            // in the case of upgrade from to we have to create the runtime activityInstance (when a matching historicActivityInstance is found)
            HistoricActivityInstanceEntity historicActivityInstance = getHistoryManager().findHistoricActivityInstance(executionEntity, true);
            if (historicActivityInstance != null) {
                activityInstance = createActivityInstance(historicActivityInstance);


        return activityInstance;

Do you have any ideas to help us ?

Thank you very much