cancel
Showing results for 
Search instead for 
Did you mean: 

When a CallActivity fails, the Workflow never ends

calbertts
Champ in-the-making
Champ in-the-making
Hi everyone,

I'm facing a problem with asynchronous workflows.
I have this design:

workflow1:
start -> ScriptActivity1 (is throwing a NullPointerException to test error handling) -> end


workflow2:
start -> CallActivity (which calls workflow1) -> end

I'm seeing that if I deploy the workflow as asynchronous, if workflow1 fails, the workflow2 never ends, but this isn't happening when the they are deployed as synchronous.

Also if I execute workflow1 only, it fails correctly showing the corresponding exception.

Does anyone know how to deal with this problem?
7 REPLIES 7

vasile_dirla
Star Contributor
Star Contributor
Hi,
will have to reproduce the issue and investigate it.
could you create a unit test for it ? (it will help a lot for reproducing the issue)

calbertts
Champ in-the-making
Champ in-the-making
Hi Vasile,

Thanks for answering, I've created a unit test trying to reproduce the scenario, when the variable ASYNC is true, the error isn't shown and I don't know how to catch it, when it's false it works as I expect.

Thanks in advance!

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I would say that the problem is that job is executed and exception is thrown. Based on the exception _retries are decreased (from 3 -> 0). Job is re-executed 3 times and it is not fetched any more. That's normal async job exception handling.
You can re-execute the job again by setting retries to e.g. 1.

http://activiti.org/userguide/index.html#jobExecutorConfiguration

regards
Martin

calbertts
Champ in-the-making
Champ in-the-making
I don't want retries, I just want to catch the exception the first time and then to deal with the exception, for any reason in the unit test running in debug mode it seems the custom command is never executed, do you know why?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I've just add your test to the activiti test project template.
The exception is

org.activiti.engine.ActivitiException: problem evaluating script: javax.script.ScriptException: org.activiti.engine.ActivitiException: Cannot get property 'prop' on null object

Could you create jUnit test project please?
https://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin

calbertts
Champ in-the-making
Champ in-the-making
Hi Martin,

I've created this repo with the Unit Test template for activiti:
https://github.com/calbertts/activiti-unit-test-template

Reading the docs, I was able to came up with solution to finish the parent workflow if a subworkflow fails, I'm using a boundary event, I'm not sure if this would be the right approach, but the problem now is that I'd like to make the parent workflow fail if a subprocess fail.

In the unit test I added some logs to show the execution flow, I'm seeing that the parent process receives this event when the subprocess fails: ACTIVITY_ERROR_RECEIVED

But the main process finishes successfully with: JOB_EXECUTION_SUCCESS

How can I throw an error if a sub process fails?

Remember I'm running everything asynchronously.

Thanks

trademak
Star Contributor
Star Contributor
Hi,

The easiest way to accomplish this is probably to catch the exception in the sub process and use an error end event there. On the call activity you can then define a boundary error event. This is an unit test that's part of the Activiti test suite:

https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/test/resources/org/acti...

Best regards,