Wrong compensation order when using subprocess as compensation

Hello,

I am having trouble with compensation order when using compensation subprocesses or call activities. I am using camunda 7.8. Please see the example .bpmn files.

Everything works as expected when using only simple Service task. Methods called within the expressions of the service tasks are invoked in the correct order (“Do something first” and then “Do something second”)


compensation-order-ok.bpmn (9.2 KB)

The problem comes when the compensation is a sub process or when I try to call it as a call activity. The compensation event subscription created timestamps are not matchintg so that the comparison of those two events should be working fine.


compensation-order-not-ok.bpmn (13.4 KB)

Am I missing something or is that a bug in camunda?

P.S. Both the service task in the happy flow have async before set to true.

Thank you
Adam

Could you please provide a test case for this? That makes it easiest for us to look into this. You can use the unit testing template on github to get started: https://github.com/camunda/camunda-engine-unittest. Thanks!

Hello Thorben,

I created the test case you asked for. Please see https://github.com/klajmajk/camunda-compensation-order-test.

At the end I created much simpler test process which showcases the problem described in my first post. I created two test methods compensationOrderOk() and compensationOrderNotOk()which are exactly the same but each uses different process definition. One passes the test and the other doesn’t.

Hope it helps.

Adam

Hello @thorben,

I want to ask whether my testcase was useful for assessing the potential bug.

Thank you
Adam

Hi Adam,

I’m sorry I didn’t get back to you earlier, your response slipped my attention.

Thanks for the providing the test case, that made it easy to debug and confirm the problem. This is indeed a bug in the process engine for which I have raised a JIRA issue: https://app.camunda.com/jira/browse/CAM-9120.

Cheers,
Thorben

Hi @thorben,

I am facing the issue. I checked the JIRA ticket but it seems to be still open. When can we expect the fix? or any work around for now?

Regards,
Hetal

Hi Hetal,

I’m afraid we have other topics that have higher priority for us, so that a fix is currently not planned. We are happy to receive a bug fix as a contribution, although it likely requires some deeper digging into the core engine.

As for workarounds, maybe you can create a single compensation event subprocess that compensates everything in the correct order and skips compensation steps if nothing needs to be done.

Cheers,
Thorben

1 Like

Thanks Thorben for quick response. Sure I will give a try for fix.

Regards
Hetal

Dear Camunda developers,

Is this bug going to be fixed?

The issue is still open Incorrect execution order on subprocess compensation · Issue #2313 · camunda/camunda-bpm-platform (github.com)