-
Bug Report
-
Resolution: Fixed
-
L3 - Default
-
None
-
None
-
None
Environment (Required on creation):
- Any Camunda engine version
- BPMN process with an intermediate signal event using an expression to call DelegateExecutionContext.getCurrentDelegationExecution()
Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):
When an intermediate signal event uses an expression like ${Somebean.getSignalName()} to call DelegateExecutionContext.getCurrentDelegationExecution(), the call returns null.
Steps to reproduce (Required on creation):
- Create a BPMN process including an intermediate signal event
- The signal event calls some delegation class via expression (e.g., ${Somebean.getSignalName()})
- The delegation code executes and returns the result of the following call: DelegateExecutionContext.getCurrentDelegationExecution()
- The result is null
To reproduce the issue, you can simply run the spring boot application: https://github.com/rtkohl/signal-name-test
Observed Behavior (Required on creation):
When running the example project mentioned above, first a service task calls the problematic code. This works fine. The current execution is returned.
The delegate for the signal activity returns null for the following call:
String activityId = DelegateExecutionContext.getCurrentDelegationExecution().getCurrentActivityId();
Expected behavior (Required on creation):
The activity id of the signal event is returned.
Root Cause (Required on prioritization):
The intermediate signal activity is a scope. This means that a new execution is created for it.
This is done here: https://github.com/camunda/camunda-bpm-platform/blob/cab8852cda1822b7d4551122b70bc56fa7f2f2b8/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/operation/PvmAtomicOperationCreateScope.java#L40
The new execution is never set for the DelegateExecutionContext. The call still returns the process instance execution.
Solution Ideas (Optional):
Set the newly created execution as context execution on the delegate invocation. Then the context is updated in the DefaultDelegateInterceptor: https://github.com/camunda/camunda-bpm-platform/blob/cab8852cda1822b7d4551122b70bc56fa7f2f2b8/engine/src/main/java/org/camunda/bpm/engine/impl/delegate/DefaultDelegateInterceptor.java#L89