Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 432675

Summary: mvn build error: Tracing dependencies for: almond java.lang.StackOverflowError
Product: [ECD] Orion Reporter: Adrian Aichner <adrian.aichner>
Component: ClientAssignee: Michael Ochmann <michael.ochmann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mamacdon, michael.ochmann
Version: 6.0   
Target Milestone: 7.0   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
mvn clean install log file (see description for command)
none
See StackOverflowError caused by Tracing dependencies for: almond none

Description Adrian Aichner CLA 2014-04-12 12:52:11 EDT
I get that error whether I initiate a maven build in the server repository or the client repository.

I will attach the log for the client side build:

    adrian@apa:~/git/org.eclipse.orion.client$ alias dtz
    alias dtz='date +%Y%m%dT%H%M%S%z'
    adrian@apa:~/git/org.eclipse.orion.client$ nohup mvn clean install -DbuildLabel=`date -u +%Y%m%d-%H%M` > mvn-clean-install-`dtz`.log &

It all ends in a stack trace I am quoting from the attached log file.

Let me know what other information you might need.

Any tips to get past this?

Adrian

     [java] Tracing dependencies for: almond
     [java] java.lang.StackOverflowError
     [java] 	at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1769)
     [java] 	at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2188)
     [java] 	at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:72)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1._c_parsePrimaryExpression_357(Unknown Source)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1.call(Unknown Source)
     [java] 	at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
     [java] 	at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
     [java] 	at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
     [java] 	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1._c_anonymous_422(Unknown Source)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1.call(Unknown Source)
     [java] 	at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1._c_parseLeftHandSideExpressionAllowCall_364(Unknown Source)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1.call(Unknown Source)
     [java] 	at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1._c_parsePostfixExpression_366(Unknown Source)
     [java] 	at org.mozilla.javascript.gen._var_home_adrian_git_org_eclipse_orion_client_target_requirejs__r_js_1.call(Unknown Source)
     [java] 	at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
Comment 1 Adrian Aichner CLA 2014-04-12 12:55:04 EDT
Created attachment 241918 [details]
mvn clean install log file (see description for command)
Comment 2 Adrian Aichner CLA 2014-04-12 12:56:36 EDT
Comment on attachment 241918 [details]
mvn clean install log file (see description for command)

adrian@apa:~/git/org.eclipse.orion.client$ alias dtz
alias dtz='date +%Y%m%dT%H%M%S%z'
adrian@apa:~/git/org.eclipse.orion.client$ nohup mvn clean install -DbuildLabel=`date -u +%Y%m%d-%H%M` > mvn-clean-install-`dtz`.log &
Comment 3 Mark Macdonald CLA 2014-04-23 13:18:00 EDT
Sorry, but I haven't encountered this error before. You could try increasing the stack size by passing -Xss2048k to the <java> tasks in orion.mini.xml.

Or when you invoke Maven pass the -DskipBrowser argument, which should skip over the step where the offending file (the standalone compare widget) is built.

[1] https://github.com/mozilla/rhino/issues/67#issuecomment-13410864
Comment 4 Adrian Aichner CLA 2014-05-02 10:54:55 EDT
(In reply to Mark Macdonald from comment #3)
> Sorry, but I haven't encountered this error before. You could try increasing
> the stack size by passing -Xss2048k to the <java> tasks in orion.mini.xml.
> 
> Or when you invoke Maven pass the -DskipBrowser argument, which should skip
> over the step where the offending file (the standalone compare widget) is
> built.
> 
> [1] https://github.com/mozilla/rhino/issues/67#issuecomment-13410864

Running
nohup mvn clean install -e -X -DbuildLabel=`date -u +%Y%m%d-%H%M` -DskipBrowser > mvn-clean-install-e-X-DskipBrowser-`dtz`.log &
in ~/git/org.eclipse.orion.client it all ends with this:

  15457      [java] ../orion/compare/compareView.css$
  15458      [java]   URL not a relative URL, skipping: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAASCAYAAABxYA+/AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAUSURBVBhXY2RgYPgPxAxMIGIwMgCpaAEjILHq8AAAAABJRU5ErkJggg=="$
  15459      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/cfui/css/logs.css$
  15460      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/cfui/css/deploy.css$
  15461      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/content/content.css$
  15462      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/js-tests/javascript/mocha.css$
  15463      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/js-tests/editor/textMateStyler/test.css$
  15464      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/profile/user-profile.css$
  15465      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/profile/css/user.css$
  15466      [java] Optimizing (standard.keepLines) CSS file: /var/home/adrian/git/org.eclipse.orion.client/optimized/profile/user-list.css$
  15467      [java] $
  15468      [java] Tracing dependencies for: index$
  15469      [java] TypeError: Cannot read property "normalize" from undefined$
  15470      [java] In module tree:$
  15471      [java]     index$
  15472      [java] $
  15473      [java] Error: TypeError: Cannot read property "normalize" from undefined$
  15474      [java] In module tree:$
  15475      [java]     index$
  15476      [java] $
  15477   [antcall] Exiting /var/home/adrian/git/org.eclipse.orion.client/releng/org.eclipse.orion.client.releng/builder/orion.mini.xml.$
  15478       [ant] Exiting /var/home/adrian/git/org.eclipse.orion.client/releng/org.eclipse.orion.client.releng/builder/orion.mini.xml.$
Comment 5 Mark Macdonald CLA 2014-05-02 12:55:57 EDT
Sigh, not seeing that error either -- and I ran a test mvn build on ubuntu using the same command as you.

Some googling suggests that this can happen when the RequireJS build config is missing paths for a RequireJS plugin [1].

But for index.js the only plugins needed should be 'domReady' and 'text', and both are properly defined in the paths config of orion.build.js.

[1] https://github.com/jrburke/r.js/issues/221
Comment 6 Adrian Aichner CLA 2014-05-02 17:41:32 EDT
(In reply to Mark Macdonald from comment #5)
> Sigh, not seeing that error either -- and I ran a test mvn build on ubuntu
> using the same command as you.
> 
> Some googling suggests that this can happen when the RequireJS build config
> is missing paths for a RequireJS plugin [1].
> 
> But for index.js the only plugins needed should be 'domReady' and 'text',
> and both are properly defined in the paths config of orion.build.js.
> 
> [1] https://github.com/jrburke/r.js/issues/221

Thanks for your help, Mark!

I think that
    TypeError: Cannot read property "normalize" from undefined
might be a side-effect of a prior failed build due to the stackoverflow error.

I assumed I could just build again with
mvn clean install
but the result it that
    TypeError: Cannot read property "normalize" from undefined
which I don't see when I first do a
adrian@apa:~/git/org.eclipse.orion.client$ git reset --hard master
after a failed build.

I can, alas, not get over this
    938      [java] $
    939      [java] Tracing dependencies for: almond$
    940      [java] java.lang.StackOverflowError$
even when I use -Xss32M

I am attaching the tail of my latest build log.

I have verified the Xss argument is being used:

pgrep -l -f java > pgrep-l-f-java-`dtz`.txt

      1 11739 /usr/lib/jvm/java-1.6.0-openjdk-i386/bin/java -Xss8192k -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar -Dclassworlds.conf=/usr/share/maven/bin/m2.conf -Dmaven.home=/usr/share/maven org.codehaus.plexus.classworlds.launcher.Launcher clean install$
      2 11811 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java -Xss32M -classpath /var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/args4j.jar:/var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/closure-compiler.jar:/var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/guava.jar:/var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/json.jar:/var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/jsr305.jar:/var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/protobuf-java.jar:/var/home/adrian/git/org.eclipse.orion.client/target/requirejs/lib/rhino.jar org.mozilla.javascript.tools.shell.Main -version 180 /var/home/adrian/git/org.eclipse.orion.client/target/requirejs//r.js -o /var/home/adrian/git/org.eclipse.orion.client/releng/org.eclipse.orion.client.releng/builder//scripts/orion.build.js appDir=/var/home/adrian/git/org.eclipse.orion.client/staging baseUrl=./ dir=/var/home/adrian/git/org.eclipse.orion.client/optimized$

I ran maven with
export MAVEN_OPTS="-Xss8192k"
hence that argument for process 11739
Comment 7 Adrian Aichner CLA 2014-05-02 17:48:00 EDT
Created attachment 242639 [details]
See StackOverflowError caused by Tracing dependencies for: almond

     [java] Tracing dependencies for: almond
     [java] java.lang.StackOverflowError
     [java] 	at org.mozilla.javascript.ScriptRuntime.toNumber(ScriptRuntime.java:356)
     [java] 	at org.mozilla.javascript.ScriptRuntime.toInteger(ScriptRuntime.java:1068)
Comment 8 Michael Ochmann CLA 2014-09-10 08:44:03 EDT
Did you find a solution for this problem Adrian?

I get the same error on Windows with a SUN JDK (both version 6 and 7) even when decorating all java calls with <jvmarg value="-Xss32M" /> in orion.mini.xml and using -DskipBrowser.

The only way to get that build to work seems to switch off minification completely with -Dorion.client.build.skip.
Comment 9 Adrian Aichner CLA 2014-09-10 08:54:14 EDT
(In reply to Michael Ochmann from comment #8)
> Did you find a solution for this problem Adrian?

Hi Michael, no I did not.

> 
> I get the same error on Windows with a SUN JDK (both version 6 and 7) even
> when decorating all java calls with <jvmarg value="-Xss32M" /> in
> orion.mini.xml and using -DskipBrowser.
> 
> The only way to get that build to work seems to switch off minification
> completely with -Dorion.client.build.skip.

Ah, I have not tried that, thanks!
Comment 10 Michael Ochmann CLA 2014-09-10 11:42:27 EDT
Mark's hint regarding the <java> tasks was actually pointing into the right direction. I just overlooked that there were in total three <java> task calls in the orion.mini.xml script, and two of them were missing a <jvmarg> argument for setting the stack size:

https://git.eclipse.org/r/33194

To my surprise I found that 1024k is sufficient! The default stack size seems to vary widely among JVMs and platforms. Anything between 32k and 1M is possible according to a quick research. That explains why Mark could not reproduce the problem: He picked a JVM with a large enough default stack size. We didn't. Bad luck.

Still, this script is awfully slow (partly because the "almond" dependencies are analyzed again and again) and I'd stick with -Dorion.client.build.skip except for release builds.
Comment 12 Mark Macdonald CLA 2014-09-10 15:33:45 EDT
(In reply to Michael Ochmann from comment #10)
> Still, this script is awfully slow (partly because the "almond" dependencies
> are analyzed again and again) and I'd stick with -Dorion.client.build.skip
> except for release builds.

It would be much faster if we could combine the almond builds into 1 invocation of the optimizer, but I'm not sure if it's possible. They each pass slightly different values to the 'wrap' option, for one thing.