Process instace end time on DB

Hi everybody!

I have a process which contains only service tasks. I set it up with a FULL history level and in the act_hi_procinst table, only the start_time_ column is set. The end_time_ column is null, even the process instance has ended.

Botton line: I’m developing a monitoring tool based on Camunda’s DB. One of my metrics is the time elapsed of a process instance. If it’s not on the act_hi_procinst, where can i find it?

Best regards.

Hi @fernando,

Can you please attach your model?

Thanks…

Hello Hassang, thanks for the replay.

Yep, I’ve made a model that does a simple verification of a boolean variable. testHistory.bpmn (6.3 KB)

Also, here is my Camunda config XML:

<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.camunda.bpm.extension.process_test_coverage.junit.rules.ProcessCoverageInMemProcessEngineConfiguration">
    <property name="history" value="full" />
    <property name="expressionManager">
        <bean class="org.camunda.bpm.engine.test.mock.MockExpressionManager"/>
    </property>
    <property name="processEnginePlugins">
      <list>
        <bean class="org.camunda.spin.plugin.impl.SpinProcessEnginePlugin" />
      </list>
    </property>
  </bean>
	<bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">				
		<property name="cacheCapacity" value="120" />  
	</bean>
</beans>

And here, we have a print screen where shows the current state of the record. Note that the column end_time_ is null.

I don’t know if it’s relevant, but I’m using PostgreSQL 10.

It tried the process and it’s working fine for me.
Which Camunda version do you use?

Hi @Yana.

I’m using version 7.10 and Camunda as a maven dependency.

<properties>
        <camunda.version>7.10.0</camunda.version>

Does the problem occur with all of the instances which do you start or only with this particular?
Can you navigate to the runtime view in Cockpit and check if the instance is still running, there are tokens in the view.

1 Like

Hi @fernando,

Only If you were using parallel gateway instead of exclusive gateway then we may have remaining active activity even if one token reaches the end event.
But for the current above model, process instance should ends when token reaches the end event.

Hi @Yana , how you doing?

Yes, with all instances executed.

Hi @hassang.
I’ve debug the code and set breakpoints throughout the code. The curious thing is that the public setter method “setEndTime” is never reached.

Look the prints where I put the breakpoints:
In this first print, the code never enters the “else”. I deduced that the "dbEntityManager.insert(historyEvent) is the insert on the table act_hi_procinst, setting the start_time_. And the else, where we see the dbEntityManager.merge(historyEvent) is the update that should set the end_time_ column.

In this print, we see the setStartTime and setEndTime method. The set setStartTime is reached, but setEndTime is not.

The class I’m inspecting is HistoricScopeInstanceEvent
print3

Hi @hassang

I received an e-mail with your reply, but you withdrawn your post. But I’ve changed the undefined task to service task. The result is here testHistory.bpmn (6.7 KB)

But the column end_time_ still remain null →

I withdrew it because I found out that even with undefined tasks it should works…

I tried it with h2 db and it worked.

Hello @hassang.

I’ll try a different aproach. I’ll install a brand new Camunda engine and new configuration and execute this same bpmn. I’ll come back later with the results.

Thanks a lot @hassang and @Yana

Hello @fernando,
I am facing the same issue endtime always null.

using: rest-api 7.11 with Postgres DB

Hi @aalbacha

I still haven’t found what the issue was. But since this is not a critical problem for my application, I’ve decided to deal with it later. If I find anything important, I’ll report here.

What is the version of your PostgreSQL?

Hi @Fernando,
Postgres 12

If you set “Async” on any element, end_time_ will be set. I also have the same problem. This is weird because remove_time_ is set correctly even if I am using the endTimeBased strategy and that’s why I expected end_time_ to be set as well.