Generated instance disappear

My camunda spring boot app sometimes could not find again generated process instance id.
My start instance code:
ProcessInstance processInstance = camunda.getRuntimeService().startProcessInstanceByKey(theProcessName, variables);

My retrieve code after few minutes:
RuntimeService runtimeService = camunda.getRuntimeService();
ProcessInstanceQuery instanceQuery = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId);
ProcessInstance pi = instanceQuery.singleResult();

Do you have any same experience? And what is your solutions?

@quang0804 can you upload your BPMN model? Does your proces contains only service tasks?

It’s a little sensitive so I can show U the image.
After I retried to submit it worked correctly and I could found the Process Instance at the Review step

@quang0804 check if any incidents are been created

Thank you. I will cjeck.

I couldn’t found any incident.
An other thing, It seems the instance was not committed to the database. So I couldn’t found any relate record to the process instance id in any history table.
We are using camunda 7.10.0 with Oracle Database 11g Enterprise Edition Release - 64bit Production.
Do you think the database session was terminated somehow?

@quang0804 if the process is executed in synchronous manner and if any exceptions occurred in between before the execution reaches the user task, engine won’t commit the instance data to db. Check if there are any exceptions in server logs.

You can try to reproduce the issue by starting the process asynchronously. This way engine will persist the data even if the execution failed.

@aravindhrs. Thank you.
I enabled camunda debug logging and trying to reproduce the case.

@aravindhrs Regarding the asynchronously you mentioned above. Did you mean checking the Asynchronous Before or after on Start event?

Thank you

Yes correct. Put async before

Is it possible that the process is already completed by the time you query it? Then you won’t find it via the runtime service. You should use the history service then.

1 Like