swallowzhang / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

java.lang.StackOverflowError while creating JSDocs #320

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm currently running into a stack overflow error while creating my JSDocs. 
I've eliminated some "WARNING: Trying to document abc as a member of 
undocumented symbol xyz" messages above it to no avail.

The error message looks like:

java.lang.StackOverflowError
        at org.mozilla.javascript.ScriptableObject.equivalentValues(ScriptableObject.java:825)
        at org.mozilla.javascript.ScriptRuntime.eqString(ScriptRuntime.java:2809)
        at org.mozilla.javascript.ScriptRuntime.eq(ScriptRuntime.java:2754)
        at org.mozilla.javascript.gen.c7._c7(Unknown Source)
        at org.mozilla.javascript.gen.c7.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c20._c4(Unknown Source)
        at org.mozilla.javascript.gen.c20.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c20._c6(Unknown Source)
        at org.mozilla.javascript.gen.c20.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c20._c15(Unknown Source)
        at org.mozilla.javascript.gen.c20.call(Unknown Source)
        at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
        at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
        at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
        at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
        at org.mozilla.javascript.gen.c20._c15(Unknown Source)
        at org.mozilla.javascript.gen.c20.call(Unknown Source)
        at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
        at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
        at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
        at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
        at org.mozilla.javascript.gen.c20._c15(Unknown Source)
        at org.mozilla.javascript.gen.c20.call(Unknown Source)
        at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
        at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)

*the above six lines are repeated many times until finally*

js: exception from uncaught JavaScript throw: java.lang.StackOverflowError

Any idea what's going on or how to work around / debug this?

Original issue reported on code.google.com by umi...@gmail.com on 5 May 2011 at 6:49

GoogleCodeExporter commented 8 years ago
You could try running jsdebug.jar instead of jsrun.jar. Choose "break on 
errors" (I think that's the wording) menu item and press the run button. If 
that isn't helpful you can send me the offending code and I'll give it a look: 
micmath@gmail.com

Original comment by micmath on 5 May 2011 at 6:59

GoogleCodeExporter commented 8 years ago
Thanks, I tried using jsdebug with "break on exceptions" enabled but get memory 
exceptions in the debug console (Java itself is running out of memory while 
running Rhino).
I'll email about the code...

The stacktraces look like:

java.lang.OutOfMemoryError: Java heap space
    at org.mozilla.javascript.Interpreter.initFrame(Interpreter.java:4293)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3282)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173)
    at org.mozilla.javascript.tools.shell.Main.evaluateScript(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processFileSecure(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processFile(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processSource(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processFiles(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main$IProxy.run(Unknown Source)
    at org.mozilla.javascript.Context.call(Context.java:499)
    at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
    at org.mozilla.javascript.tools.shell.Main.exec(Unknown Source)
    at org.mozilla.javascript.tools.debugger.Main.main(Unknown Source)
    at JsDebugRun.main(Unknown Source)
js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: Java 
heap space

and

java.lang.OutOfMemoryError: GC overhead limit exceeded
    at org.mozilla.javascript.ScriptRuntime.createFunctionActivation(ScriptRuntime.java:3098)
    at org.mozilla.javascript.Interpreter.initFrame(Interpreter.java:4241)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3282)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173)
    at org.mozilla.javascript.tools.shell.Main.evaluateScript(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processFileSecure(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processFile(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processSource(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main.processFiles(Unknown Source)
    at org.mozilla.javascript.tools.shell.Main$IProxy.run(Unknown Source)
    at org.mozilla.javascript.Context.call(Context.java:499)
    at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
    at org.mozilla.javascript.tools.shell.Main.exec(Unknown Source)
    at org.mozilla.javascript.tools.debugger.Main.main(Unknown Source)
    at JsDebugRun.main(Unknown Source)
js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: GC 
overhead limit exceeded

Original comment by umi...@gmail.com on 5 May 2011 at 11:01

GoogleCodeExporter commented 8 years ago
Right guys, I've been experiencing this very same issue.

The cause in my case was entirely based on human error.

If you do this:

/** @extends Foo **/
var Foo = function() { /* ... */ }

jsdoc-toolkit just recurses and recurses and recurses until... BAM! The stack 
overflows.

I'm uncertain whether other tags are also subject to this.

Original comment by andrew.j...@googlemail.com on 28 Jul 2011 at 11:18

GoogleCodeExporter commented 8 years ago
Hi,

I got the same error on a human error too :

BaseClass.extend('Foo', 
/**@lends Foo#*/
{
    /**
      * @constructs
      * @class    
      * @extends Foo //Here is my mistake the class Foo extends BaseClass and not Foo
      */ 
      constructor: function(){
        }
});

Because our code base is very consequent, we used this simple bash script to 
find in which file the problem occurs :

for i in `find path/to/your/project -name *.js`; do echo "Testing $i"; java 
-jar $JSDOCDIR/jsrun.jar $JSDOCDIR/app/run.js -d=doc/jsdoc 
-t=doc/jsdoc/templates -v -r=2 $i > /dev/null 2>&1 || echo "=>>>> Error in $i"; 
done

Original comment by andreas....@gmail.com on 2 Sep 2011 at 2:02