Steps to reproduce:
1) deploy a process and a case (the process must call the case)
2) start an instance of the process
3) terminate the process instance
4) try to complete the case
Problem:
A NullPointerException is thrown:
java.lang.NullPointerException at org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity.setSuperExecution(CaseExecutionEntity.java:468) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractAtomicOperationCaseExecutionComplete.postTransitionNotification(AbstractAtomicOperationCaseExecutionComplete.java:98) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.eventNotificationsCompleted(AbstractCmmnEventAtomicOperation.java:40) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.eventNotificationsCompleted(AbstractCmmnEventAtomicOperation.java:26) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.execute(AbstractCmmnEventAtomicOperation.java:26) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:214) at org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity.performOperationSync(CaseExecutionEntity.java:865) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.execute(AbstractCmmnEventAtomicOperation.java:26) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:214) at org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity.performOperation(CaseExecutionEntity.java:860) at org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution.complete(CmmnExecution.java:829) at org.camunda.bpm.engine.impl.cmmn.behavior.StageActivityBehavior.checkAndCompleteCaseExecution(StageActivityBehavior.java:456) at org.camunda.bpm.engine.impl.cmmn.behavior.StageActivityBehavior.handleChildCompletion(StageActivityBehavior.java:398) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractAtomicOperationCaseExecutionComplete.postTransitionNotification(AbstractAtomicOperationCaseExecutionComplete.java:106) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.eventNotificationsCompleted(AbstractCmmnEventAtomicOperation.java:40) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.eventNotificationsCompleted(AbstractCmmnEventAtomicOperation.java:26) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.execute(AbstractCmmnEventAtomicOperation.java:26) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:214) at org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity.performOperationSync(CaseExecutionEntity.java:865) at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58) at org.camunda.bpm.engine.impl.cmmn.operation.AbstractCmmnEventAtomicOperation.execute(AbstractCmmnEventAtomicOperation.java:26) at org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:214) at org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity.performOperation(CaseExecutionEntity.java:860) at org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution.manualComplete(CmmnExecution.java:833) at org.camunda.bpm.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:285) at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.completeTask(CompleteTaskCmd.java:61) at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:55) at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:30) 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.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66) at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30) at org.camunda.bpm.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:165)
Hint:
See forum post: https://forum.camunda.org/t/tasks-of-a-nested-case-instance-terminated-by-message-correlation-stay-active/1546