End Listener of Process unexpectedly called it's interrupted by an event subprocess

I have the following process map (this is a simplified version of my real process map):

During the process, a message might arrive at any time signifying that the due date is changed. If the new due date is in the past, I want to terminate the entire process. If it is not in the past, then the message has no effect on the process. So I modeled this by having a non-interrupting message event receive a due date changed message. If the due date is in the past, then I throw a signal. Then another event subprocess receives the signal, perform another task, then end the process. I have an ‘end’ listener on the process so that whenever the process is killed (in the real process map, there are many ways the process can terminate), an external script is executed.

The problem I’m encountering is that the end listener is executed when the non-interrupting event throws the signal and the interrupting event subprocess catches it. The process, however, is still active as the task in the second event subprocess has not been completed (see the image). This is a huge problem because the external script should only be called when the process completes, not before!

The end listener is not called when I throw ‘terminate process’ signal via rest API, but it’s called when the non-interrupting event subprocess throws the signal. I experimented with having message events instead of signal events, or having a terminate end event instead of signal throw end event, but both produce the same problem as well.

This seems like a bug in Camunda. Why is the end listener of the process called even when the main process is active?

Thank you,

Hi @dain3265,

can you provide a test case + BPMN to analyze the behavior?

Best regards,

Hi @Philipp_Ossler ,

Here’s the BPMN for my test case: test_process.bpmn (9.6 KB)

I set the end execution listener to create a variable called ‘EndListenerCalled’ and set it to ‘true’. After starting a process, if I send ‘signal-${execution.processBusinessKey}’ via RestAPI, this terminates the process and create a variable ‘EndListenerCalled’ with value ‘true’ as expected.

Instead of a signal however, if I send a message with name ‘DueDateMessage’ and include a variable ‘DueDate’ with value ‘in_the_past’ (and thereby broadcasting ‘Terminate Process’ signal with expression ‘signal-${execution.processBusinessKey}’), then the process moves to the second event subprocess and also calls the end execution listener. You can see that the end listener was called because the same ‘EndListenerCalled’ variable has been created with value ‘true’. But the process is still in progress and has not been terminated yet.

Hi @Philipp_Ossler, do you need any other information?

I just found that the end listeners is called twice:

  1. Once by the bug I described earlier when the signal is thrown (but the process is still in progress)
  2. Second, when the process actually completes (i.e when ‘Another Task’ in the ‘Terminate Process’ subprocess completes).

The second one is what I expect to happen, but I do not expect the first to happen.

Good catch :+1:

I can reproduce the issue and agree that this is a bug. Can you please create a new bug issue?
Thank you!

@Philipp_Ossler How can I create a bug issue?

You can create a new issue in your Jira. See the contribution guide: https://camunda.com/learn/community/#contribute

Great. I created this bug issue: https://app.camunda.com/jira/browse/CAM-9608.
Is there an approx. timeline for when this bug will be solved?
Thank you

Thank you for creating the issue :+1: I can’t promise anything but hopefully it will be in the next release (middle of next year). You can speed it up by providing a fix as pull request.