Hi,
I’m currently getting a StackOverflowError when using the following API call:
processEngine.getRepositoryService().deleteDeployment(deploymentId, true /* cascade */, true /* skip custom listeners */);
The deployment I’m trying to delete has executed only once, but had many repeating interval timers on it that fired. I have an example workflow that triggers it, I put the repeating interval timer at 1 second so it executes a lot quickly, to illustrate the problem.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://www.camunda.org/test">
<process id="run_timer" isExecutable="true" name="run timer">
<documentation/>
<startEvent id="StartEvent_155asxm">
<outgoing>SequenceFlow_0hm761k</outgoing>
</startEvent>
<userTask id="UserTask_1cscyf5" name="Initial Triage">
<incoming>SequenceFlow_0hm761k</incoming>
<outgoing>SequenceFlow_0164571</outgoing>
</userTask>
<boundaryEvent attachedToRef="UserTask_1cscyf5" cancelActivity="false" id="BoundaryEvent_0vgxv66" name="test">
<outgoing>SequenceFlow_01kmm80</outgoing>
<timerEventDefinition>
<timeCycle xsi:type="tFormalExpression">R/PT1S</timeCycle>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="SequenceFlow_0hm761k" sourceRef="StartEvent_155asxm" targetRef="UserTask_1cscyf5"/>
<userTask id="UserTask_1jxwl6p" name="Interview key individuals">
<incoming>SequenceFlow_01kmm80</incoming>
<outgoing>SequenceFlow_0ztf2fi</outgoing>
</userTask>
<sequenceFlow id="SequenceFlow_01kmm80" sourceRef="BoundaryEvent_0vgxv66" targetRef="UserTask_1jxwl6p"/>
<endEvent id="EndEvent_0s80z0m">
<incoming>SequenceFlow_0164571</incoming>
<incoming>SequenceFlow_0ztf2fi</incoming>
</endEvent>
<sequenceFlow id="SequenceFlow_0164571" sourceRef="UserTask_1cscyf5" targetRef="EndEvent_0s80z0m"/>
<sequenceFlow id="SequenceFlow_0ztf2fi" sourceRef="UserTask_1jxwl6p" targetRef="EndEvent_0s80z0m"/>
<textAnnotation id="TextAnnotation_1kxxiyt">
<text>Start your workflow here</text>
</textAnnotation>
<association id="Association_1seuj48" sourceRef="StartEvent_155asxm" targetRef="TextAnnotation_1kxxiyt"/>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane bpmnElement="undefined" id="BPMNPlane_1">
<bpmndi:BPMNShape bpmnElement="StartEvent_155asxm" id="StartEvent_155asxm_di">
<omgdc:Bounds height="36" width="36" x="138" y="173"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="0" width="0" x="180" y="208"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="TextAnnotation_1kxxiyt" id="TextAnnotation_1kxxiyt_di">
<omgdc:Bounds height="30" width="100" x="88" y="254"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="Association_1seuj48" id="Association_1seuj48_di">
<omgdi:waypoint x="152" xsi:type="omgdc:Point" y="208"/>
<omgdi:waypoint x="141" xsi:type="omgdc:Point" y="254"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape bpmnElement="UserTask_1cscyf5" id="UserTask_1cscyf5_di">
<omgdc:Bounds height="80" width="100" x="295.1098484848485" y="277.5858585858586"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="BoundaryEvent_0vgxv66" id="BoundaryEvent_05yifv1_di">
<omgdc:Bounds height="36" width="36" x="362" y="340"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="12" width="18" x="370" y="379"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_0hm761k" id="SequenceFlow_0hm761k_di">
<omgdi:waypoint x="174" xsi:type="omgdc:Point" y="191"/>
<omgdi:waypoint x="235" xsi:type="omgdc:Point" y="191"/>
<omgdi:waypoint x="235" xsi:type="omgdc:Point" y="318"/>
<omgdi:waypoint x="295" xsi:type="omgdc:Point" y="318"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="13" width="0" x="250" y="247.5"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape bpmnElement="UserTask_1jxwl6p" id="UserTask_1jxwl6p_di">
<omgdc:Bounds height="80" width="100" x="539.2022988505747" y="442.68850574712644"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_01kmm80" id="SequenceFlow_01kmm80_di">
<omgdi:waypoint x="380" xsi:type="omgdc:Point" y="376"/>
<omgdi:waypoint x="380" xsi:type="omgdc:Point" y="483"/>
<omgdi:waypoint x="539" xsi:type="omgdc:Point" y="483"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="13" width="0" x="395" y="422.5"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape bpmnElement="EndEvent_0s80z0m" id="EndEvent_0s80z0m_di">
<omgdc:Bounds height="36" width="36" x="629.52067381317" y="281.4617151607963"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="13" width="0" x="647.52067381317" y="320.4617151607963"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_0164571" id="SequenceFlow_0164571_di">
<omgdi:waypoint x="395" xsi:type="omgdc:Point" y="318"/>
<omgdi:waypoint x="512" xsi:type="omgdc:Point" y="318"/>
<omgdi:waypoint x="512" xsi:type="omgdc:Point" y="299"/>
<omgdi:waypoint x="630" xsi:type="omgdc:Point" y="299"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="13" width="0" x="527" y="301.5"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="SequenceFlow_0ztf2fi" id="SequenceFlow_0ztf2fi_di">
<omgdi:waypoint x="589" xsi:type="omgdc:Point" y="443"/>
<omgdi:waypoint x="589" xsi:type="omgdc:Point" y="380"/>
<omgdi:waypoint x="648" xsi:type="omgdc:Point" y="380"/>
<omgdi:waypoint x="648" xsi:type="omgdc:Point" y="317"/>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="13" width="0" x="618.5" y="358"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
I’ve created a unit test which reproduces the problem
package org.camunda.bpmn.engine;
import org.camunda.bpm.engine.ManagementService;
import org.camunda.bpm.engine.runtime.Job;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.junit.Rule;
import org.junit.Test;
public class DeleteDeploymentStackOverflowTest {
@Rule
public ProcessEngineRule processEngineRule = new ProcessEngineRule("camunda.cfg.xml");
@Deployment(resources = {"stackoverflow.bpmn20.xml"})
@Test
public void testDeleteDeploymentWithTimerExecutionsCausesStackOverflow() throws InterruptedException {
processEngineRule.getRuntimeService().startProcessInstanceByKey("run_timer");
ManagementService managementService = processEngineRule.getManagementService();
for (int i = 0; i < 1000; i++) {
Job job = managementService.createJobQuery()
.activityId("BoundaryEvent_0vgxv66")
.singleResult();
managementService.executeJob(job.getId());
}
}
}