cancel
Showing results for 
Search instead for 
Did you mean: 

Process freeze on Shell Task with Batch and Python

naoki
Champ in-the-making
Champ in-the-making
Hi all,

I'm researching to use external REST API and thought Shell Task with Python might be good solution.
If there's better way, please let me know.

I've read manual here:
http://www.activiti.org/userguide/#bpmnShellTask

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

It works simple Windows command (ex. echo), but using Python freeze the process and browser.
It waits process done forever (or until timeout). Browser shows waiting icon and do not respond.

It works following:
OK: simple DOS command
OK: simple batch file
OK: batch file in batch file (note: don't use "call")

Followings are not working and cause freeze:
NG: python (even –version)
NG: batch file call python
NG: batch file call another batch file with "call"

I've tried "wait" option (default=true) as false. Then process comes back, but there's no result value evaluated. It's also critical.

If there's any workaround or better solution to use external REST API, please let me know.
Any advice is helpful.

Thank you,
Naoki

5 REPLIES 5

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Naoki,

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

Regards
Martin

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

Thank you very much for following up.
I'm not familiar enough to make jUnit test in time.

But I made test case files as attached.

And 2 findings:
1) No issue with Python, but "redirectError" option needed to be enabled ("true") to see output from Python.

2) The freeze issue was not from Python or calling another batch file. It seems number of lines of batch file. It is included commented out line with "rem". If the batch file has max 11 lines of code (command or comment), it seems working fine. But if it became 12 lines, it cause freeze.

Thank you,
Naoki


jbarrez
Star Contributor
Star Contributor
I can't really test this, as i'm on OSX, but it sounds very odd that the lines of commands make a difference.
Are you talking about 12 'activiti:field' entries, and then it freezes?

naoki
Champ in-the-making
Champ in-the-making
It's windows batch file.
I forgot mention about the OS I'm using.
It is Windows Server 2008 R2 Enterprise. Service Pack 1. 64 bit on Intel Xenon X5670.

> Are you talking about 12 'activiti:field' entries, and then it freezes?
No.
If line of batch file is 11, it is OK. But 12 lines causes freeze.
But it seems not execute any command or no output captured.

Batch file is called as following in above test code.
  CDATA[C:\_test2\test01.bat]

The batch file in test code was not clear of the lines. Following batch file would be same result.
Extra empty line does not count and does not effect result. Command lines and rem lines are counted.
I mean not only 12 lines. 12 lines or more have this issue.

==== OK case begin ===
echo test01
rem line 02
rem line 03
rem line 04
rem line 05
rem line 06
rem line 07
rem line 08
rem line 09
rem line 10
rem line 11

==== OK case end ===

==== NG case begin ===
echo test01
rem line 02
rem line 03
rem line 04
rem line 05
rem line 06
rem line 07
rem line 08
rem line 09
rem line 10
rem line 11
rem line 12

==== NG case end ===

It looks very odd. First I thought it caused by the file size of batch file.
12 lines could come from the machine spec.
But I think hundreds of lines batch file would reproduce more cases.

Thank you,
Naoki

jbarrez
Star Contributor
Star Contributor
I can't think of any reason why this would happen … so I'm afraid I can't really help you right now …
The command line call is done by the ShellActivityBehavior: https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
I don't see anything wrong there, but maybe you can debug there and see what happens that would explain it?