7.3.1 [functionName] is not a function ERROR

Guys,

This is a really weird one. I have a form that has a long method that has been working perfectly for 3 years. It works fine in Developer, but when deployed it gets this error:

SEVERE: Throwable
org.mozilla.javascript.EvaluatorException: Program too complex (out of locals) (macadamia/forms/frm_memb/getPubsMember#1232)
	at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:103)
	at org.mozilla.javascript.Context.reportRuntimeError(Context.java:956)
	at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1003)
	at org.mozilla.javascript.optimizer.BodyCodegen.getNewWordLocal(Codegen.java:4647)
	at org.mozilla.javascript.optimizer.BodyCodegen.generatePrologue(Codegen.java:1589)
	at org.mozilla.javascript.optimizer.BodyCodegen.generateBodyCode(Codegen.java:1300)
	at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:317)
	at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:183)
	at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:101)
	at org.mozilla.javascript.Context.compileImpl(Context.java:2470)
	at org.mozilla.javascript.Context.compileFunction(Context.java:1421)
	at org.mozilla.javascript.Context.compileFunction(Context.java:1413)
	at com.servoy.j2db.scripting.ScriptEngine.compileScriptProvider(ScriptEngine.java:567)
	at com.servoy.j2db.scripting.ScriptEngine.compileFunction(ScriptEngine.java:532)
	at com.servoy.j2db.scripting.LazyCompilationScope.getImpl(LazyCompilationScope.java:174)
	at com.servoy.j2db.scripting.LazyCompilationScope.get(LazyCompilationScope.java:128)
	at com.servoy.j2db.scripting.FormScope.get(FormScope.java:257)
	at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:2141)
	at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1815)
	at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2211)
	at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:86)
	at org.mozilla.javascript.gen.macadamia_forms_frm_memb_getPubsMember_181._c_getPubsMember_0(macadamia/forms/frm_memb/getPubsMember:1232)
	at org.mozilla.javascript.gen.macadamia_forms_frm_memb_getPubsMember_181.call(macadamia/forms/frm_memb/getPubsMember)
	at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:88)
	at org.mozilla.javascript.gen.macadamia_forms_frm_memb_downloadBtnClick_180._c_downloadBtnClick_0(macadamia/forms/frm_memb/downloadBtnClick:1028)
	at org.mozilla.javascript.gen.macadamia_forms_frm_memb_downloadBtnClick_180.call(macadamia/forms/frm_memb/downloadBtnClick)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3204)
	at org.mozilla.javascript.gen.macadamia_forms_frm_memb_downloadBtnClick_180.call(macadamia/forms/frm_memb/downloadBtnClick)
	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:624)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:4990)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:4872)
	at com.servoy.j2db.FormController.executeFunction(FormController.java:4739)
	at com.servoy.j2db.FormController$ScriptExecuter.executeFunction(FormController.java:4584)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:276)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:218)
	at com.servoy.j2db.smart.dataui.AbstractScriptLabel$5.mouseReleased(AbstractScriptLabel.java:929)
	at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$200(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Server Information
Servoy version 7.3.1 -releaseNumber 2022
Port used by RMI Registry: 1100
Repository version 44 (84069230-C635-4EED-BEF2-13B6E0DE47A8)

JVM Information
java.vm.name=Java HotSpot™ Client VM
java.version=1.7.0_13
java.vm.info=mixed mode
java.vm.vendor=Oracle Corporation

Operating System Information
os.name=Windows Server 2008
os.version=6.0
os.arch=x86

System Information
Heap Space Memory: allocated=538508K, used=138339K, max=1267072K
Non-Heap Space Memory: allocated=69536K, used=69442K, max=163840K
Number of Processors: 4

Servoy is telling you what’s wrong:

Program too complex

:lol: :lol: :lol:

sorry… :wink:
No clue why this happens

I would try blowing out the repository database and uploading your solution fresh.

Harjo:
Servoy is telling you what’s wrong:

Program too complex

:lol: :lol: :lol:

sorry… :wink:
No clue why this happens

Mozilla tells that. ;)

Mozilla says also:

(out of locals)

This refers to the local slots in the Rhino Javascript. See here: https://github.com/mozilla/rhino/blob/m … degen.java
Also a search reveals this snippet from here: http://permalink.gmane.org/gmane.comp.mozilla.devel.jseng.rhino/1168

Yes, the JVM has a limit of 256 local slots, where a double/long
consumes two slots. Rhino could presumably be smarter about saving and
restoring locals in an object to get past this limit, but the
complexity of that hasn’t yet been justified as not too many people
hit this limit.

As far as I can gather local slots are the underlying storage mechanism for local variables.
It is possible that your code being lengthy has too many.
Try breaking methods/functions into smaller pieces.
Just my suggestion…

Hi Tom,

Thanks for that! It is a pretty long method with many variables. It’s strange that this worked just fine in all previous versions of Servoy… :)

I appreciate your tip!

Bob

if you keep running in interpreted mode then this will work fine also in de client
(developer and web always do that)
you can set a system property: system.property.servoy.disableScriptCompile=true through the admin page so that also the smart client doesn’t compile to byte code.