Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-8756

Deleting Parent and Child process instances via API throws NPE

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Won't Fix
    • Icon: L3 - Default L3 - Default
    • 7.6.x, 7.7.x, 7.8.x
    • None
    • engine
    • None

      If we want to delete super process instance and sub process instance via deleteProcessInstances we get a NPE.
      If we use the async method we got:
      org.camunda.bpm.engine.BadUserRequestException: No process instance found for id '10': processInstance is null .

      We should ensure that if the subprocess is already deleted, we should skip deleting it again.

      How to reproduce:

      • Change RuntimeServiceAsyncOperationsTest#testDeleteProcessInstancesAsyncWithoutSkipSubprocesses to:
          [...]
            final List<ProcessInstance> list = runtimeService.createProcessInstanceQuery()
                                                             .list();
        
            // when
            Batch batch = runtimeService.deleteProcessInstancesAsync(Arrays.asList(list.get(0).getId(), list.get(1).getId()), null, TESTING_INSTANCE_DELETE, false, false);
            executeSeedJob(batch);
            executeBatchJobs(batch);
        [...]
        
      • Add test in CallActivityTest:
      
        @Deployment(resources = {
            "org/camunda/bpm/engine/test/bpmn/callactivity/CallActivity.testCallSimpleSubProcess.bpmn20.xml",
            "org/camunda/bpm/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml"
        })
        public void testS()
        {
          ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callSimpleSubProcess");
      
          // one task in the subprocess should be active after starting the process instance
          TaskQuery taskQuery = taskService.createTaskQuery();
          Task taskBeforeSubProcess = taskQuery.singleResult();
          assertEquals("Task before subprocess", taskBeforeSubProcess.getName());
      
          // Completing the task continues the process which leads to calling the subprocess
          taskService.complete(taskBeforeSubProcess.getId());
          Task taskInSubProcess = taskQuery.singleResult();
          assertEquals("Task in subprocess", taskInSubProcess.getName());
      
          runtimeService.deleteProcessInstances(Arrays.asList(processInstance.getId(), taskInSubProcess.getExecutionId()),
                                                "thats why", false, false);
      
        }
      

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              christopher.zell Christopher Kujawa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: