My start process is getting triggered twice if I use timer

Hi Team,

When I use timer to trigger my process, it gets triggered twice. Lets say, I kept the cron trigger expression to trigger at 12AM in the morning, it gets triggered at 00.00hrs and 00.03hrs. As a result, optimistic locking has occurred and we are facing a deadlock. Please find the log below.

Log:
26-Apr-2017 23:15:26.232 WARNING [pool-3-thread-1] org.camunda.commons.logging.BaseLogger.logWarn ENGINE-14006 Exception while executing job 3ca87a98-2a89-11e7-8f08-005056b10dc6:
org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of ‘DELETE TimerEntity[3ca87a98-2a89-11e7-8f08-005056b10dc6]’ failed. Entity was updated by another transaction concurrently.
at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:125)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.handleOptimisticLockingException(DbEntityManager.java:328)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:300)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:283)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:321)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:249)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:113)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:57)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Please help me in resolving this issue.

Hi @vinhard55,

please share your BPMN process.

Best regards,
Philipp

Hi @Philipp_Ossler

Please find the BPMN process file in the attachment.

Thanks in advance.

Regards,
Vinoth

startprocess.bpmn (3.0 KB)

Hi Vinoth,

which Camunda version do you use?

How long does the task “ServiceCall Task” needs to execute?

Please share the complete DB result of your query.

Best regards,
Philipp

Hi @Philipp_Ossler,

We use camunda version 7.5.0 with tomcat server. I needed that service call task to call a java class and end once it is complete. And this process should be performed every day at 12AM.

I have attached the query result below. PFA.

Query used : SELECT * FROM [dbo].[ACT_HI_JOB_LOG] where process_def_key_=‘startprocess’ order by timestamp_ desc

ACT_HI_JOB_LOG result set.csv (74.6 KB)

Please let me know if further details are required.

Thanks and regards,
Vinoth

Hi Vinoth,

can you please provide the runtime data of the related jobs from the table ACT_RU_JOB?

Best regards,
Philipp

Hi @Philipp_Ossler,

Please find the data from ACT_RU_JOB table.
ACT_RU_JOB.csv (2.6 KB)

Also, I was able to find today that it got triggered twice when the processing time in that particular service call(The java class that it calls) is more than 3 mins. Where can i increase the processing time/wait time for a particular task.

Thanks and Regards,
Vinoth

Hi Vinoth,

I think it’s because of the job’s lock time. When a job is executed by the job executor, it locks the job for a defined amount of time. If this time is exceeded then the job can be locked and executed again.

You can solve this issue by using asynchronous continuation on the service task (async-before) or on the start event (async-after).

Does this help you?

Best regards,
Philipp

1 Like

Hi Phillip.
I am also facing same issue . if it is a timer start event can we use (async-after).

Thanks in advance
Swarna

Hi @Swarna_Latha,

If the process takes more than 3 mins, this issue will occur. I tried making the retry cycle to zero and increased the lock time for a process, both did not support my case. so I’ve split my data into various sets and sent it to my process for processing. Probably you can try reducing the amount of data sent to your process or send the data in sets/batches so that it will execute it in a sequential manner reducing the load to the process that you have mentioned here and complete it within 3 mins.