cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptTask out:println causes Stack size error (sic!)

tse
Champ in-the-making
Champ in-the-making
Having process variable orderId (String) and adding scriptTask (groovy)
out:println "test" + orderId
out:println "test2"

causes:

Caused by: java.lang.VerifyError: (class: Script14, method: run signature: ()Ljava/lang/Object;) Stack size too large
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
   at java.lang.Class.getConstructor0(Class.java:2699)
   at java.lang.Class.newInstance0(Class.java:326)
   at java.lang.Class.newInstance(Class.java:308)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:259)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
   at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:216)
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:69)
   at org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:51)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85)



whole flow:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/">
  <process id="testProcess" name="TEst process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy">
      <script>out:println "test" + orderId
out:println "test2"</script>
    </scriptTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_testProcess">
    <bpmndi:BPMNPlane bpmnElement="testProcess" id="BPMNPlane_testProcess">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="320.0" y="37.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="870.0" y="37.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="scripttask1" id="BPMNShape_scripttask1">
        <omgdc:Bounds height="55.0" width="105.0" x="580.0" y="27.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="355.0" y="54.0"></omgdi:waypoint>
        <omgdi:waypoint x="580.0" y="54.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="685.0" y="54.0"></omgdi:waypoint>
        <omgdi:waypoint x="870.0" y="54.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
9 REPLIES 9

frederikherema1
Star Contributor
Star Contributor
Can you create a failing unit-test for this error?

tse
Champ in-the-making
Champ in-the-making
JUnit test is ready, however, it seems i have no rights to upload attachments Smiley Sad

frederikherema1
Star Contributor
Star Contributor
You can use any public file-charing app for that e.g.. dropbox, that's perfectly fine Smiley Wink

tse
Champ in-the-making
Champ in-the-making
Not that easy with my company's very restrictive internet-access-policy.

Here is the unit test:
https://www.dropbox.com/s/26x7m98zpodzv98/groovy-activiti-unit-test.zip

frederikherema1
Star Contributor
Star Contributor
Really strange bug, don't really see what the issue is here… The problem is that we just use the Scripting capabilities of the jdk, adding in Bindings to resolve variable-instances, but nothing that could explain an excessive stack. It seems to be related to the println-statement or am I mistaken?

tse
Champ in-the-making
Champ in-the-making
String concatenated with process variables seems to be the issue,

These work great:

out:smileytongue:rintln "test1"
out:smileytongue:rintln processVariable1
out:smileytongue:rintln "test2"

out:smileytongue:rintln "test"
out:smileytongue:rintln processVariable1
out:smileytongue:rintln "test" + processVariable1
out:smileytongue:rintln "test" + processVariable1

These fail with stack error:

out:smileytongue:rintln "test"
out:smileytongue:rintln processVariable1
out:smileytongue:rintln "test" + processVariable1
out:smileytongue:rintln processVariable1

out:smileytongue:rintln "test" + processVariable1
out:smileytongue:rintln processVariable1

Rather hard to find any pattern…

frederikherema1
Star Contributor
Star Contributor
Are you using this inside of Grails? What version of groovy are you using?

tse
Champ in-the-making
Champ in-the-making
I believe everything is in the pom.
If you ask about my project, I don't use grails.
In both the unit test and the project I use:

      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>1.7.5</version>

jbarrez
Star Contributor
Star Contributor
I've honestly got no clue about this one … maybe try with a more recent version of groovy, see http://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all/2.0.6