cancel
Showing results for 
Search instead for 
Did you mean: 

Process Debugger

ruediger_hain
Champ in-the-making
Champ in-the-making
Hi,
we are prototyping a process debugger for Activiti.
One feature we need in the debugger is setting breakpoints so that the process execution will stop before/after reaching a certain activity.

Our idea was to merge an artificial breakpoint activity into the original process definition which would behave as a wait state.
This might work (we havent tried yet) but seems like an ugly hack, there should be some support for this in the engine.

Are there any hooks planned to support breakpoints in the future?
Or can you give any hints how to accomplish this?
17 REPLIES 17

tombaeyens
Champ in-the-making
Champ in-the-making
In that case i don't yet see the relation between debugging and that kind of breakpoints.

bernd_ruecker
Champ in-the-making
Champ in-the-making
That depends how fast you are with your Debugger 😉

falko_menge
Champ in-the-making
Champ in-the-making
Rüdiger, Vladimir and me discussed this topic in more detail during a workshop last week and came to the conclusion that an event listener is not sufficient for debugging at the BPMN level.

Our conclusion arises from the fact that the current BPMN Parallel Gateway implementation does not execute the paths in parallel, but rather one after another in a somewhat random order. Hence, stopping the engine in a parallel section through an event listener would leave the process in a state were other paths may not even have started to execute. If there are interdependencies, e.g., via BPMN Events or Data Flow, among the parallel paths, there might be constellations, which cannot be reached through event-based debugging or even cause a deadlock.

That leaves two options:
1. The Parallel Gateway could be fixed to be really parallel, e.g., using multiple threads. This way an event-listener would only block one path in a parallel section, but not the entire process instance. This fix might even be needed to support certain BPMN use-cases.

2. A debugging interface could be introduced in the PVM together with an according service in the engine module. The idea would be to switch the engine into a debug mode either programmatically at runtime or through configuration at startup, which would then enable additional checks for active breakpoints. The advantage of such a solution would be, that it is highly transparent and allows for debugging on a logical process level independent from implementation details. Rüdiger and his colleagues have might be able to contribute such a feature and we already discussed a possible implementation strategy.

tombaeyens
Champ in-the-making
Champ in-the-making
BPMN execution assumes persistent usage of the Activiti engine.  In this mode, you move from one state to another in a transaction.  This means transactional control flow.  You have typically only 1 TCP JDBC connection to your DB.  So parallel gateway is not something that needs to be 'fixed' imo.  In the persistent use case, it is like it should be.

If your goal is to debug software that will run in this same persistent environment, then process debugging should not differ from the persistent execution mode.  Hence it is good to have the exact same execution semantics in debug as well as in runtime mode.

Maybe you're talking about a different use case.  Where you want to provide analysts with a BPMN simulator.  In that case I understand your request.  To support that use case we have to discuss implementation strategies here on this list.  My first thoughts are towards the atomic operations.  The while loop of atomic operations could be interrupted when a breakpoint is reached.   Probably there are other alternatives.  This research would take quite some time i think.

Also other, more urgent features are waiting on finishing the atomic operations like asynchronous continuations.  Meaning, the idea for async continuations is that they get send over a message and later the execution is loaded and the atomic operation is then performed asynchronously.  But some state in the execution is not persisted.  It should be passed in the message (in the job).  This is not implemented yet.  And dealing with those very same memberfields is what you'ld need to do for an atomic based solution as well.

Let's analyse the use case further:  what *exactly* is it that you want?  If my assumption correct that this is for a BPMN simulation environment for analysts, rather then for debugging persistent BPMN executable processes?  In what other ways is this environment different?  What alternatives do we see for implementation strategies?

ruediger_hain
Champ in-the-making
Champ in-the-making
The use case is what you call a BPMN simulation environment.
It's meant to be used by process developers (business analysts etc.) who dont really care about internal workings of the engine itself but on process semantics.
We came up with a similar solution you are suggesting (prevent AtomicOperationActivityExecute or activityBehaviour.execute() from being called and invoke it later after the breakpoint). The engine would need to provide a hook to prevent the operation execution. This could be added as a full blown debug api or in a more general purpose and non-invasive way. For example you could provide the AtomicOperations through a factory rather than constants in the AtomicOperation interface. In debug mode this factory could provide a special AtomicOperationActivityExecute which does the breakpoint checks.

tombaeyens
Champ in-the-making
Champ in-the-making
For BPMN process simulation, i think it is best to write a completely different set of activities.
Check out the test suite of the current trunk activiti-pvm module.  It contains a great starting point for implementing those.
Then you don't have any persistence involved.

Then you could have say a SimulationProcessDefinition extends ProcessDefinitionImpl that creates SimulationExecution extends ExecutionImpl.
Then you can overwrite the performAtomicOperation method or any other method.

tombaeyens
Champ in-the-making
Champ in-the-making
If you want to do this properly, you have to create extend the activiti-pvm test suite with tests that validate your simulation use case.  maybe even create a separate simulation module.

Only if your use case ends up in our test suite that all developers run before they commit, then it can survive the test of time.  If it is not part of the test suite, you will always struggle to upgrade.

yaronwittenstei
Champ in-the-making
Champ in-the-making
Hi,
1. is there any release expectation for this feature?
2.  The feature will have the option to re-play an historical process-executions ?
I mean, Would it be possible to import a process-instance-execution from the history-database and
play it visually while having options to break at certain points and inspect variables…?

Best Regards,
    Yaron