Orchestrator Workflows fail with stack overflow error when attemtping to concatenate a large number of strings
search cancel

Orchestrator Workflows fail with stack overflow error when attemtping to concatenate a large number of strings

book

Article ID: 341312

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

Symptoms:
  • Attempts to concatenate a large number of strings fails during Orchestrator Workflow execution.
  • The Orchestrator log files located under /services-logs/prelude/vco-app/file-logs/vco-server-app.log contain a StackOverflow warning similar to:

2023-06-14T08:47:21.977Z WARN vco [host='vco-app-85fdc9cf-n7cx7' thread='WorkflowExecutorPool-Thread-2' user='<USERNAME>' org='<UUID>' trace='-'] {|__SYSTEM|<USERNAME>:<WorkflowName>:<UUID>:token=<TokenID>} ch.dunes.workflow.engine.mbean.helper.WorkflowHandler - Error in execution of workflow '<WorkflowName> for wfExecution[<WorkflowExecutionID>]
java.lang.StackOverflowError: null
        at org.mozilla.javascript.ConsString.appendTo(ConsString.java:73) ~[rhino-1.7R4.jar:1.7R4]
        at org.mozilla.javascript.ConsString.appendFragment(ConsString.java:79) ~[rhino-1.7R4.jar:1.7R4]
        at org.mozilla.javascript.ConsString.appendTo(ConsString.java:73) ~[rhino-1.7R4.jar:1.7R4]
        at org.mozilla.javascript.ConsString.appendFragment(ConsString.java:79) ~[rhino-1.7R4.jar:1.7R4]
        at org.mozilla.javascript.ConsString.appendTo(ConsString.java:73) ~[rhino-1.7R4.jar:1.7R4]


Environment

VMware vRealize Orchestrator 8.x
VMware Aria Automation Orchestrator 8.12.x

Cause

The javascript engine we leverage uses ConsString objects to represent the result of string concatenations. This improves performance, but can cause StackOverflowError when the value is computed if there are many nested concatenations.

Resolution

To resolve the issue leverage the .valueOf() method that can be used to flatten the ConsString object into a string. The following code block contains an example of its use:

var list = ""; // list is of type string
var org_code = "org_code"; // org_code is of type string

list = list + org_code; // list is now of type ConsString
list = list.valueOf(); // list is now of type string


Alternatively you can increase the Orchestrator stack size from 256k to 1M:

Note: Stack size is 1M by default in version 8.13.1 and later.

  1. Open an SSH session to any one node in the cluster.
  2. Run the following command:
Caution: The command will terminate and restart vco-app pods to apply the change.
 

base64 -d <<< "ZWNobyAiUGF0Y2hpbmcgZGVwbG95bWVudCB0ZW1wbGF0ZSIKdnJhY2xpIGNsdXN0ZXIgZXhlYyAtLSBzZWQgLWkgInMvLlwvY3JlYXRlX3NlcnZlcl9zeW1saW5rcyBcJlwmIHJtLy5cL2NyZWF0ZV9zZXJ2ZXJfc3ltbGlua3MgXCZcJiBzZWQgLWkgXCdzXC9Yc3MyNTZrXC9Yc3MxTVwvXGcnIFwvdXNyXC9saWJcL3Zjb1wvYXBwLXNlcnZlclwvYmluXC9zZXRlbnYuc2ggXCZcJiBybS9nIiAvb3B0L2NoYXJ0cy92Y28vdGVtcGxhdGVzL2RlcGxveW1lbnQueWFtbAoKZWNobyAiUGF0Y2hpbmcgZXhpc3RpbmcgZGVwbG95bWVudCIKa3ViZWN0bCAtbiBwcmVsdWRlIGdldCBkZXBsb3ltZW50IHZjby1hcHAgLW8geWFtbCB8IHNlZCAicy8uXC9jcmVhdGVfc2VydmVyX3N5bWxpbmtzIFwmXCYgcm0vLlwvY3JlYXRlX3NlcnZlcl9zeW1saW5rcyBcJlwmIHNlZCAtaSBcJ3NcL1hzczI1NmtcL1hzczFNXC9cZycgXC91c3JcL2xpYlwvdmNvXC9hcHAtc2VydmVyXC9iaW5cL3NldGVudi5zaCBcJlwmIHJtL2ciIHwga3ViZWN0bCAtbiBwcmVsdWRlIHJlcGxhY2UgLWYgLQoKZWNobyAiRG9uZSI=" | bash -