Team,
We are randomly getting below error when we are executing a flow in Camunda.
Error occurred executing work
org.camunda.bpm.engine.impl.pvm.PvmException: cannot signal execution a89ff46a-b32c-11eb-9e0e-00505697b9a7: it has no current activity
** at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.signal(PvmExecutionImpl.java:716)**
** at org.camunda.bpm.engine.impl.cmd.SignalCmd.execute(SignalCmd.java:63)**
** at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)**
** at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)**
** at org.camunda.bpm.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:58)**
** 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.RuntimeServiceImpl.signal(RuntimeServiceImpl.java:429)**
This is happening randomly when we are sending signal to Camunda from our service task.
Sample code below: (where execID is processInstanceId & data is data which we want to pass to camunda engine)
ProcessEngines.getDefaultProcessEngine().getRuntimeService().signal(execId, null, data,
null);
Please let us know your thoughts.
Hi Sanu,
Did you check the Signal API documentation here: Triggering (Throwing) Signals
Throwing a signal in your case could look like this:
@Component("deductCreditDelegate")
public class DeductCreditDelegate implements JavaDelegate {
private final Logger LOGGER = LoggerFactory.getLogger(DeductCreditDelegate.class.getName());
public void execute(DelegateExecution execution) throws Exception {
Map variables = new HashMap(); // Init variables as you wish
RuntimeService rs = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
// Get the process instance Id to only trigger the signal to it
String id = execution.getProcessInstanceId();
rs.createSignalEvent("signalTest")
.executionId(id)
.setVariables(variables)
.send();
}
}
Hope this could help
Hi Sebastien,
Thanks for the reply. Maybe Sandesha did not give a full context. Let me give that.
We have a custom Task Node (stencil) created in our deployment. We call it InteractiveFlow task node. This task node has its own java delegate class that extends from org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.
When, in an execution, Camunda BP flow hits this InteractiveFlow Task node, the delegate class will start the task which is in essence another workflow implemented using jBPM. This task will run in a separate thread. While this Interactive task is in progress, the Camunda thread (delegate class) will wait for a signal to proceed.
Once the interactive flow complestes, it will send the signal and the delegate class gets over the control and proceeds.
While this works fine with low load, say 10-20 executions per min, but as and when the load is increased we see the above exception.
class CallInteractiveFlowTaskDelegate extends AbstractBpmnActivityBehavior {
@Override
public void doExecute(final ActivityExecution execution) throws Exception {
// Call and execute the Interactive flow jBPM process
}
@Override
public void signal(ActivityExecution execution, String signalEvent, Object signalData)
throws Exception {
// Wait for the execution of the jBPM process to complete
// Once signal is received, proceeed
}
}
And when the jBPM interactive flow ends we send out the signal
ProcessEngines.getDefaultProcessEngine().getRuntimeService().signal(execId,null, data, null);
Please note that the custom Interactive node does not take any signal name and hence we cannot pass the signalName while calling the rs.createSignalEvent(“signalTest”)
Any further suggestion is highly appreciated.