- process as in the diagram attached
- When sending the message, then the terminate end event cancels the send task instance (i.e. execution ends). Nevertheless, execution continues after the send task and fails with a NullPointerException at the end event.
- Termination ends the execution of the send task and we already have logic that stops executing ended executions (https://github.com/camunda/camunda-bpm-platform/blob/7.5.0/engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/AtomicOperationInvocation.java#L64-L68). However, PvmExecutionImpl#leaveActivityViaTransitions resets the isEnded flag, so the check does not work in this case (https://github.com/camunda/camunda-bpm-platform/blob/7.5.0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java#L971).
- if this is in an embedded sub process, then the exception is not a NullPointerException but with a ProcessEngineException when trying to create an activity execution mappings (due to the IS_SCOPE_ flag being reset for the sub process scope execution)