Unable to update task record, and workflow is stuck on "Rollback to" activity


Description


java.lang.StackOverflowError
at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:2315)
at org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:959)
at org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:905)
at org.mozilla.javascript.ScriptRuntime.toString(ScriptRuntime.java:795)
at org.mozilla.javascript.NativeArray.toStringHelper(NativeArray.java:848)
at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:270)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:102)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:965)
at org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:905)
at org.mozilla.javascript.NativeArray.getDefaultValue(NativeArray.java:526)
at org.mozilla.javascript.ScriptRuntime.toBoolean(ScriptRuntime.java:369)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_59(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:1406)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_22(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:686)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_22(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:695)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_22(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:695)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_22(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:695)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_22(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:695)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166._c_anonymous_22(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script:695)
at org.mozilla.javascript.gen.sys_script_include_3d68dd633b130000dada82c09ccf3d28_script_267166.call(sys_script_include.3d68dd633b130000dada82c09ccf3d28.script)

Cause

The root cause is the incorrect use of the "Rollback To" activity.

The "Rollback To" activity changes the history records of the activities and resets approvals and tasks that it's rolling back. But to do this it has to build large memory models of how the flow executed. If the activity is not resetting approvals and tasks, there really is no need to use 'Rollback To'. They can just remove the activity and just transition back to the point where they are doing their next thing. 

These flows are doing lots of loops and eventually the Rollback To Activity and the WorkflowModelManager can only handle so many iterations before they start to run into memory and stack issues in our javascript engine.

Resolution