Accessing sc_req_item list view causes recursive loop resulting stack overflow with input of type choice


Description

Viewing the sc_req_item list may hang until the user transaction times out.  This occurs when a sc_req_item is associated with a flow that calls and an action or subflow with an input of type choice that is driven by the stage column on table sc_req_item.  The issue does not happen consistently, only when the associated flow needs to be recompiled-- i.e. the flow or one of its dependents has been altered and reactivated or a new release has been installed, etc.

Steps to Reproduce

Install attached update set sys_remote_update_set_2c8be41273331010d70877186bf6a7dd.xml
Go to Service Catalog > Maintain Items
Select the item CSTASK118216 item
Try It
Go to sc_req_item.list

You will see the stack trace below repeated many times and eventually there will be a Stack Over flow. The node could crash:
org.mozilla.javascript.gen.sys_script_8a88819bc611227800af8eaaa932544e_555._c_sc_req_item_stageGetChoices_1(sys_script.8a88819bc611227800af8eaaa932544e:60)
at org.mozilla.javascript.gen.sys_script_8a88819bc611227800af8eaaa932544e_555.call(sys_script.8a88819bc611227800af8eaaa932544e)
at org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2678)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2617)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
at org.mozilla.javascript.gen._refname__7220._c_script_0(<refname>:1)
at org.mozilla.javascript.gen._refname__7220.call(<refname>)
at org.mozilla.javascript.gen._refname__7220.exec(<refname>)
at com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
at com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
at com.glide.script.SysChoice.getChoicesFunction(SysChoice.java:766)
at com.glide.script.SysChoice.getAllChoices(SysChoice.java:642)
at com.glide.choice.ChoiceListGenerator.getChoiceList(ChoiceListGenerator.java:272)
at com.glide.pojo.ElementDescriptorPlainObjectBuilder.getChoicesFromChoiceListGenerator(ElementDescriptorPlainObjectBuilder.java:193)
at com.glide.pojo.ElementDescriptorPlainObjectBuilder.getDefinitionChoices(ElementDescriptorPlainObjectBuilder.java:147)
at com.glide.pojo.ElementDescriptorPlainObjectBuilder.populateParamWithoutHint(ElementDescriptorPlainObjectBuilder.java:103)
at com.glide.flow_design.helpers.FDParameterHelper.parameterMapFromEDMap(FDParameterHelper.java:37)
at com.glide.flow_design.helpers.ComponentInstanceHelper.elementsToVars(ComponentInstanceHelper.java:243)
at com.glide.flow_design.helpers.ComponentInstanceHelper.getInstanceValues(ComponentInstanceHelper.java:182)
at com.glide.flow.data.ActionInstanceGlideRepository.getActionInstanceValues(ActionInstanceGlideRepository.java:124)
at com.glide.flow.data.ActionInstanceGlideRepository.getActionInstance(ActionInstanceGlideRepository.java:69)
at com.glide.flow.data.ActionInstanceGlideRepository.getActionInstancesByFlowSysId(ActionInstanceGlideRepository.java:93)
at com.glide.flow.data.FlowGlideRepository.getFlowBySysId(FlowGlideRepository.java:190)
at com.glide.flow.providers.FlowGlideProvider.createFlowInstance(FlowGlideProvider.java:374)
at com.glide.flow.providers.FlowGlideProvider.getFlow(FlowGlideProvider.java:257)
at com.glide.flow_trigger.engine.FlowPlanRetriever.recompileAndCacheProcessPlan(FlowPlanRetriever.java:134)
at com.glide.flow_trigger.engine.FlowPlanRetriever.retrieve(FlowPlanRetriever.java:101)
at com.glide.flow_trigger.engine.FlowPlanRetriever.projectedStages(FlowPlanRetriever.java:54)
at com.glideapp.servicecatalog.CalculationHelper.getFlowStages(CalculationHelper.java:175)
at sun.reflect.GeneratedMethodAccessor1459.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:300)
at org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2612)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
at org.mozilla.javascript.gen.sys_script_8a88819bc611227800af8eaaa932544e_555._c_sc_req_item_stageGetChoices_1(sys_script.8a88819bc611227800af8eaaa932544e:60)

Workaround

Change the action input to type String instead of Choice backed by sc_req_item.stage.  A Choice not backed by sc_req_item.stage will also work as expected.


Related Problem: PRB1438114