AnsweredAssumed Answered

Strange behaviour query/signal multi instance receive task

Question asked by aapthorp on Feb 18, 2013
Latest reply on Sep 12, 2014 by aggiepilot04
I have a process with a multi instance receive task i.e. one instance for the number of messages I expect to receive before the receive task completes.

When I query the receive task (as per the user guide but returning a list) I always get one extra execution returned. i.e. expect 2 get 3, etc. The returned ids always match what I find in the database (ACT_HI_ACTINST) except for the second one. I can never find this id.

The behaviour then gets stranger. If I signal the first execution I get an NPE error. However, signalling the second execution succeeds!

18-Feb-2013 19:40:49 org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
java.lang.NullPointerException
        at org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior.leave(ParallelMultiInstanceBehavior.java:96)
        at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:49)
        at org.activiti.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior.signal(ReceiveTaskActivityBehavior.java:35)
        at org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.signal(MultiInstanceActivityBehavior.java:102)
        at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:353)
        at org.activiti.engine.impl.cmd.SignalCmd.execute(SignalCmd.java:45)
        at org.activiti.engine.impl.cmd.NeedsActiveExecutionCmd.execute(NeedsActiveExecutionCmd.java:52)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:60)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
        at org.activiti.engine.impl.RuntimeServiceImpl.signal(RuntimeServiceImpl.java:170)
        at com.ajita.activiti.MessageSender.notify(MessageSender.java:60)
        at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)

Has anyone else run into this issue or has no one else tried multi instance receive tasks?

I assume the reason for one extra task, is in effect a parent for each of the individual tasks, but then how is this stored in the database?

At what point does the individual multi task get marked as ended? When each one is signalled?

Outcomes