NullPointerException on jobexecutor.TimerCatchIntermediateEventJobHandler

1,753 views
Skip to first unread message

galen...@gmail.com

unread,
Dec 6, 2013, 12:02:54 PM12/6/13
to camunda-...@googlegroups.com
Hi,

I'm not sure if I'm getting a NullPointerExecption in the camunda code when I have a cycle with a timer. I saw this exception in a more complex flow, but I simplified it down to this:

http://camunda.org/share/#/process/cdb35790-3bf3-4201-bd4f-7f5f1d843688

It seems to cycle successfully for about 3 or 4 times, but it always ends up with the following failure (see stacktrace below). At first I thought this might be due to the same variable name being set, but I disabled the setting of variables, and the problem still happens.

NOTE: the timer is setup to fire every 30 seconds (at 0 seconds and 30 seconds after each minute)

Any ideas?

Thanks,
Galen


SEVERE: Error while closing command context
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:35)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:92)
at org.camunda.bpm.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:59)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd execute
SEVERE: Failure while executing org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd for job id '87'. Falling back to standard job retry strategy.
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable run
WARNING: Exception while executing job with id 87
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:35)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:92)
at org.camunda.bpm.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:59)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:35)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:92)
at org.camunda.bpm.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:59)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd execute
SEVERE: Failure while executing org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd for job id '87'. Falling back to standard job retry strategy.
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable run
WARNING: Exception while executing job with id 87
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:35)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:92)
at org.camunda.bpm.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:59)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:35)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:92)
at org.camunda.bpm.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:59)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd execute
SEVERE: Failure while executing org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd for job id '87'. Falling back to standard job retry strategy.
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity.setExecution(IncidentEntity.java:250)
at org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity.createAndInsertIncident(IncidentEntity.java:111)
at org.camunda.bpm.engine.impl.incident.FailedJobIncidentHandler.handleIncident(FailedJobIncidentHandler.java:46)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.createFailedJobIncident(JobEntity.java:202)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.setRetries(JobEntity.java:181)
at org.camunda.bpm.engine.impl.cmd.DecrementJobRetriesCmd.execute(DecrementJobRetriesCmd.java:55)
at org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd.executeStandardStrategy(FoxJobRetryCmd.java:139)
at org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd.execute(FoxJobRetryCmd.java:49)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.FailedJobListener.execute(FailedJobListener.java:47)
at org.camunda.bpm.engine.spring.SpringTransactionContext$4.afterCompletion(SpringTransactionContext.java:84)
at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:993)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:968)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:872)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:822)
at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:161)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:134)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
08:57:10,417 [pool-1-thread-3] ERROR org.springframework.transaction.support.TransactionSynchronizationUtils - TransactionSynchronization.afterCompletion threw exception
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity.setExecution(IncidentEntity.java:250)
at org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity.createAndInsertIncident(IncidentEntity.java:111)
at org.camunda.bpm.engine.impl.incident.FailedJobIncidentHandler.handleIncident(FailedJobIncidentHandler.java:46)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.createFailedJobIncident(JobEntity.java:202)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.setRetries(JobEntity.java:181)
at org.camunda.bpm.engine.impl.cmd.DecrementJobRetriesCmd.execute(DecrementJobRetriesCmd.java:55)
at org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd.executeStandardStrategy(FoxJobRetryCmd.java:139)
at org.camunda.bpm.engine.impl.cmd.FoxJobRetryCmd.execute(FoxJobRetryCmd.java:49)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.FailedJobListener.execute(FailedJobListener.java:47)
at org.camunda.bpm.engine.spring.SpringTransactionContext$4.afterCompletion(SpringTransactionContext.java:84)
at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:993)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:968)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:872)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:822)
at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:161)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:134)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Dec 6, 2013 8:57:10 AM org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable run
WARNING: Exception while executing job with id 87
java.lang.NullPointerException
at org.camunda.bpm.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:35)
at org.camunda.bpm.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:92)
at org.camunda.bpm.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:59)
at org.camunda.bpm.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:70)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.executeJob(ExecuteJobsRunnable.java:79)
at org.camunda.bpm.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)

Daniel Meyer

unread,
Dec 6, 2013, 12:35:17 PM12/6/13
to camunda-...@googlegroups.com
Hi Galen,

do you think you could maybe provide a failing testcase? If not, we will
try to reproduce it next week.

Cheers,
Daniel Meyer

galen...@gmail.com

unread,
Dec 6, 2013, 1:14:15 PM12/6/13
to camunda-...@googlegroups.com
Hi Daniel,

Here is my test case:

@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/timer/cam_cycle.bpmn"})
public void testTimerCycle() throws Exception {
try {
// Start process
//
String instanceId = runtimeService.startProcessInstanceByKey("cam_cycle").getProcessInstanceId();

// Wait for process to run to completion...
//
while (true) {
ProcessInstance processInstance =
runtimeService.createProcessInstanceQuery()
.processInstanceId(instanceId).singleResult();
if (processInstance == null) {
log.info("PROCESS ["+instanceId+"] DOES NOT EXIST ANYMORE");
break;
}
else if (processInstance.isEnded()) {
log.info("PROCESS ["+instanceId+"] ENDED");
break;
}
else {
log.info("PROCESS["+processInstance.getProcessInstanceId()+"] (suspended="+processInstance.isSuspended()+", ended="+processInstance.isEnded()+")");
}
try {
Thread.sleep(1000);
ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + 1000));
log.info("CURRENT TIME IS: "+ClockUtil.getCurrentTime());
} catch (InterruptedException e) { ; }
}
} catch (ProcessEngineException e) {
assertTextPresent("Unknown property used in expression", e.getMessage());
}

}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

But for some reason (even though the Clock is proceeding, the timer catch event never seems to fire. It's probably due to something I'm not understanding in the test framework. I added the above method to the TimeExpressionTest.java class.

Here is my BPMN:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://activiti.org/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Qog-UF6VEeO4H9y8BRwdzw" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="cam_cycle" isExecutable="true">
<bpmn2:scriptTask id="ScriptTask_1" name="log a message" scriptFormat="JavaScript">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
<bpmn2:script>java.lang.System.out.println('script task executing');</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_1" targetRef="IntermediateCatchEvent_1"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1">
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
<bpmn2:timerEventDefinition id="_TimerEventDefinition_2">
<bpmn2:timeCycle xsi:type="bpmn2:tFormalExpression">0,30 * * * * ?</bpmn2:timeCycle>
</bpmn2:timerEventDefinition>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="IntermediateCatchEvent_1" targetRef="ScriptTask_1"/>
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/>
</bpmn2:process>
</bpmn2:definitions>

Daniel Meyer

unread,
Dec 9, 2013, 10:20:44 AM12/9/13
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Galen,

we just had a look at your process:

The problem is that you use a timeCycle definition for providing the time format. This leads to a cycling behavior causing each instance of the intermediate timer event to fire an infinite number of times.

The following expression means:
<bpmn2:timeCycle xsi:type="bpmn2:tFormalExpression">0,30 * * * * ?</bpmn2:timeCycle>

every 30 seconds (at 0 seconds and 30 seconds after each minute) UNTIL THE END OF TIMES

As a result, when the first timer fires, it will not delete itself but it will stay active and fire again. So after the first timer has fired, you will end up with 2 timer jobs in the database: one for the second loop instance (OK) and one for the first loop instance (BAD, since it re-created itself). The corresponding execution will not exist any more hence the NullPointerExecption you are experiencing. 

You can fix your testcase using the following code:

  <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1">
      <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
      <bpmn2:timerEventDefinition id="_TimerEventDefinition_2">
        <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">PT30S</bpmn2:timeDuration>
      </bpmn2:timerEventDefinition>
    </bpmn2:intermediateCatchEvent>

So I think that actually <timeCycle> makes no sense in combination with the intermediate timer event: as this one should only fire once, leave the event and not fire again. It should only fire again if the event is entered a second time (as in your example) and then a new instance of the timer should be created. 

I think that the parser should reject the <timeCycle> for the following BPMN constructs:
- intermediate timer event
- interrupting boundary event
- start event for interrupting event subprocess. 

We should give this some more thought and also have a look at the BPMN specification.

Cheers,
Daniel

galen...@gmail.com

unread,
Dec 9, 2013, 6:44:30 PM12/9/13
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Daniel,

Thanks for clarifying this behavior. However, I was just using "every 30 seconds" as a simple test to verify behaviour before I changed it to "every midnight" (the real use case). For my use case it's preferable to NOT use a duration, but to have a CRON-formatted specific time. In other words, I don't always know how much time the task after the timer will take. So I can't simply say for example that it will take 30 seconds, and therefore I will perform a duration of 23 hours, 59 minutes, and 30 seconds.

I have a feeling there's a better way to architect this BPMN, and I'm just not doing it correctly. Any feedback on how to do this without using "timeDuration" would be awesome.

What I want to do is similar in concept to Figure 123 on page 203 of this link:
http://www.omg.org/bpmn/Documents/BPMN_Section_7.pdf

I think they must also be using some sort of scheduling semantics, rather than a duration, since they specify "Friday at 6 pm".

Thanks,
Galen

rwba...@gmail.com

unread,
May 13, 2014, 6:18:58 PM5/13/14
to camunda-...@googlegroups.com, galen...@gmail.com
I am experiencing this same issue (using <timeCycle>0/30 * * * * ?</timeCycle>) and am curious if a fix for this use-case exists?

Thanks,
Ron

Daniel Meyer

unread,
May 14, 2014, 7:09:25 AM5/14/14
to camunda-...@googlegroups.com, galen...@gmail.com, rwba...@gmail.com
Hi Ron,

Are you using an intermediate catch event or a different kind of event?
You cannot use TimeCycles with intermediate catch events because an intermediate event can only fire *once*. So there can be no cycle.

Time cycles work with other events like non-interrupting boundary events.

Does this help you?

Cheers,
Daniel

rwba...@gmail.com

unread,
May 15, 2014, 2:26:26 PM5/15/14
to camunda-...@googlegroups.com, galen...@gmail.com, rwba...@gmail.com
Hi Daniel,

Yes, I am trying to use an intermediate catch event to implement a timer that fires every hour. If I can't use an intermediate catch event, do you have a suggestion on implementing an hourly trigger?

Thanks,
Ron

webcyberrob

unread,
May 15, 2014, 8:33:12 PM5/15/14
to camunda-...@googlegroups.com, galen...@gmail.com, rwba...@gmail.com
Hi Ron,

Some patterns I tend to use:

If this is a reminder that some task has not been performed within SLA, the I use a non-interrupting boundary event timer on the task. As a common example, often I use asynchronous request/response services. Hence on my receive task, I use the non-interrupting boundary event timer to trigger reminders. In addition, I use a principle that I have an interrupting boundary event timer configured with a conservative timeout. The intent here is if it fires, the process is considered abandoned. The rationale is to ensure that the engine does not get clogged with abandoned processes.

Rob
Reply all
Reply to author
Forward
0 new messages