# Automatic BPMN control-flow analysis and resolution

**URL:** <https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150>\
**Category:** Meta\
**Created:** [June 6, 2024, 2:51pm UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150 "2024-06-06T14:51:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![timKraeuter](https://forum.bpmn.io/user_avatar/forum.bpmn.io/timkraeuter/32/5466_2.png) [@timKraeuter](https://forum.bpmn.io/u/timKraeuter)\
**Post date:** [June 6, 2024, 2:51pm UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/1 "2024-06-06T14:51:51Z")

</div>

During my PhD research, I implemented a tool for automatic BPMN control-flow analysis to detect deadlocks, starvation, livelocks, and other common modeling errors (the corresponding paper is currently under review).  
I was wondering if this is **interesting for [bpmn.io/camunda](http://bpmn.io/camunda)**. Or are BPMN processes usually linear in practice and do not need such analysis?

The following GIF shows how the tool finds and visualizes starvation in BPMN due to a message not always being sent. It is taken from the paper cited in an [issue of the bpmn-js-token-simultion](https://github.com/bpmn-io/bpmn-js-token-simulation/issues/14) plugin.

![ezgif-1-7f21be30f3](https://forum.bpmn.io/uploads/default/original/2X/c/c5b0188a27f67df68d29d62921cba9afb2a9baa6.gif)

You can try the tool yourself [here](https://timkraeuter.com/bpmn-analyzer-js/), where you can select different examples in the top right. The tool can even provide quick fixes to a modeler for common errors such as gateway errors (something similar could be implemented for bpmn-lint violations).

The goals of the tool are the following:

1. **Instantaneous analysis** (\< 500ms).
2. **Understandability**
3. **Automatic quick-fixes**

My [website](https://timkraeuter.com//rust-bpmn-analyzer/) provides some more details. If you are interested, I can present the tool, how I achieved the three goals, and its potential in more detail.

I am looking forward to hearing your opinion and chatting with you.

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [June 7, 2024, 8:34am UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/2 "2024-06-07T08:34:45Z")

</div>

@timKraeuter This is a really great project. Processes in the real world are (unfortunately) not linear, hence control flow analysis is an interesting and important aspect to consider.

What I really like about what you shared is that it is such a good E2E user journey. 👏

Our general take is the following:

- We try to validate what is edited through [pluggable lint rules](https://github.com/bpmn-io/bpmnlint); this gives users an early warning if they do something wrong, but it requires detection to be _fast_?
- We could build such detection as you’ve shown into token simulation; it could in fact be used to visualize (coming from a lint rule) the actual issue at hand for the user 🚀
- Mid term (but we’re not there yet): Auto fix (as you showcase)

Would you mind contributing some of the things back that you created? For example, you could create a bpmnlint plug-in or contribute some rules to the core.

I’m CCing @Ingo_Richtsmeier here, could this be interesting for consulting, too?

---

<div class="post-metadata">

**Author:** ![timKraeuter](https://forum.bpmn.io/user_avatar/forum.bpmn.io/timkraeuter/32/5466_2.png) [@timKraeuter](https://forum.bpmn.io/u/timKraeuter)\
**Post date:** [June 7, 2024, 8:05pm UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/3 "2024-06-07T20:05:16Z")

</div>

@nikku, thanks for the interest. I would love to contribute things back and see how it can impact modeling in practice.

Currently, I am pretty busy since I am **wrapping up my Ph.D.** (I plan to finish by 01.10.2024), and I am applying for **software engineering jobs** simultaneously. However, I am sure we can find a way to integrate features.

I am unsure if this analysis would fit in the context of a lint rule since I am not checking individual elements **statically**. Instead, I am analyzing the whole diagram **dynamically** , essentially trying out all possible combinations of BPMN elements (called **formal analysis** , i.e., model checking in research). Maybe we can discuss the most exciting features for you and how we can best integrate them.

Regarding _ **fast** _, the analysis is [written in Rust](https://github.com/timKraeuter/rust_bpmn_analyzer) for maximum efficiency and speed. It can be run [natively](https://bpm-2024.whitefield-c9fed487.northeurope.azurecontainerapps.io/) as a service or in the browser using [webassembly](https://timkraeuter.com/bpmn-analyzer-js/) as in the previous link above.  
I tested the performance of the native tool in my paper, and in **most** cases, this led to quite a fast analysis (providing all the details here would be too long). For example, the solutions in the [bpmn-for-research camunda repository](https://github.com/camunda/bpmn-for-research/tree/master/BPMN%20for%20Research) take **1ms each** to analyze (on my machine).

In summary, diagram size itself is not a problem. There are diagrams where the modeler breaks down before the analysis (and vice versa 😉 ). The runtime is mainly affected by diagram complexity, i.e., how many distinct execution paths exist for the given BPMN diagram (parallel branches and multiple pools contribute the most).

Let me know what you think or if you want me to present the tool in detail to you or others.

---

<div class="post-metadata">

**Author:** ![timKraeuter](https://forum.bpmn.io/user_avatar/forum.bpmn.io/timkraeuter/32/5466_2.png) [@timKraeuter](https://forum.bpmn.io/u/timKraeuter)\
**Post date:** [August 16, 2024, 7:40am UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/4 "2024-08-16T07:40:28Z")

</div>

I am sorry to revive this thread, but luckily, the paper was accepted. A [pre-print is accessible here](https://arxiv.org/abs/2408.06028) (and the [extended version here](https://arxiv.org/abs/2407.03965)). It will probably take another month to be officially published.

By the way, I also created a [YouTube Demo](https://youtu.be/Nv2W-hXNZYA?si=Bam-ucFAe8uOwsEk) as part of my paper.  
More importantly, how do you think I can best contribute something back?

- Maybe I can package it as a Camunda modeler plugin?
- Or do you prefer to extend the lint rules?

I am still writing my PhD thesis, probably until 01.11, but I might get some time and motivation to code here and there.

---

<div class="post-metadata">

**Author:** ![nikku](https://forum.bpmn.io/user_avatar/forum.bpmn.io/nikku/32/5130_2.png) [@nikku](https://forum.bpmn.io/u/nikku)\
**Post date:** [August 19, 2024, 8:27am UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/5 "2024-08-19T08:27:08Z")

</div>

@timKraeuter I believe packing this up as a [bpmnlint](https://github.com/bpmn-io/bpmnlint) extension would be amazing.

This allows folks to consume it, also in the Modeler, through a [custom linter rules plug-in](https://github.com/camunda/camunda-modeler-custom-linter-rules-plugin).

---

<div class="post-metadata">

**Author:** ![timKraeuter](https://forum.bpmn.io/user_avatar/forum.bpmn.io/timkraeuter/32/5466_2.png) [@timKraeuter](https://forum.bpmn.io/u/timKraeuter)\
**Post date:** [August 19, 2024, 8:45am UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/6 "2024-08-19T08:45:44Z")

</div>

Thanks, for the information. I will try packaging it as a bpmnlint extension when I find some time and keep you updated here.

---

<div class="post-metadata">

**Author:** ![timKraeuter](https://forum.bpmn.io/user_avatar/forum.bpmn.io/timkraeuter/32/5466_2.png) [@timKraeuter](https://forum.bpmn.io/u/timKraeuter)\
**Post date:** [August 30, 2024, 1:23pm UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/7 "2024-08-30T13:23:13Z")

</div>

@nikku I checked the bpmnlint and the custom lint plugins. I can easily write custom rules.  
However, I was wondering how to integrate things like the visualization, etc., where I currently just pass modules to the _additional modules_ in the _BPMNModeler_, see [here](https://github.com/timKraeuter/bpmn-analyzer-js/blob/master/src/app.js#L16). I use this to get XML on change (could probably be gotten from the definitions during rule check) but most importantly to interact/change the palette when showing visualizations (based on the bpmn-js-token-simulation) and change the diagram when quick-fixes are applied.  
Is this possible through a custom linting rule? Thanks for your help!

---

<div class="post-metadata">

**Author:** ![barmac](https://forum.bpmn.io/user_avatar/forum.bpmn.io/barmac/32/974_2.png) [@barmac](https://forum.bpmn.io/u/barmac)\
**Post date:** [July 9, 2025, 10:10am UTC](https://forum.bpmn.io/t/automatic-bpmn-control-flow-analysis-and-resolution/11150/8 "2025-07-09T10:10:12Z")

</div>

Closed on July 9, 2025, 10:10am UTC

Closing old topics.
