Script Task within a loop causing StackOverflowError

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 07:43 AM
We have a simple script task in a BPMN that is within a loop that is designed to loop around 500 times. The script task simply creates a string variable. We can see when we don't mark the script as asynchronous, we see a StackOverflowError after around 30 loops occur. If we mark it as asynchronous, we do not see the error.
Is there any indication why this occurs specifically with script tasks and not with any other tasks such as service tasks?
- Labels:
-
Alfresco Process Services
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 08:08 AM
After writing the recursive logic, the stack will be expanded, so StackOverflowError will occur.
How about increasing the thread stack size with JVM parameters?
-Xss:10m

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 09:53 AM
This is also something but we would need to be able to scale the stack if request and load increases on activiti, which is why I was wondering if there was something specific that only seems to cause it with script tasks in a loop, or indeed if there is an activiti element that can stop it occuring?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 03:00 PM
Since the Xss option is related to the maximum value, I think the thread size will be expanded as necessary.
If we need to examin why the stack will be expanded, we need to check your script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 07:18 AM
Makes sense. The script was simply creating an integer variable and adding 1 to it, but it is possible it can run thousands of times due it it being in a loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 04:19 PM
Well, please upload the reproduction code (>_<) if you wanto to resolve this problem.
