NullPointerException when deleting process instance


I ran into a problem when deleting a process instance via RuntimeService while the process instance is currently ending after a signal event. In my use case this situation may occure in a multi-threaded environment.

A NPE occurs in org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl#hasChildren. The problem is that the ensureExecutionsInitialized method does not really ensure this. The reason seems to be that the process instance does not have executions any more (since it has been ended in the other thread meanwhile).

I´ve written a simple JUnit-Test which provoked the situation in every run on my machine.

Is there any way to solve this situation by myself?

Thanks in advance

Any ideas? Might this be a bug which is resolved in a future version?

Best regards,