在升级到Dojo 1.7.3之后,我们在以前版本的Dojo上运行多年的ant构建现在由于内存不足错误而完全无法运行:
[java] starting writing resources...
[java] java.lang.OutOfMemoryError: GC overhead limit exceeded
[java] at org.mozilla.javascript.Interpreter.getArgsArray(Interpreter.java:4623)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.NativeArray.iterativeMethod(NativeArray.java:1565)
[java] at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:313)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] at org.mozilla.javascript.gen.c1._c62(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c69(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c40(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
[java] at org.mozilla.javascript.gen.c1._c42(Unknown Source)
[java] at org.mozilla.javascript.gen.c1.call(Unknown Source)
[java] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
[java] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
[java] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[java] at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2347)
[java] at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:272)
[java] at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:127)
[java] at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
[java] js: exception from uncaught JavaScript throw: java.lang.OutOfMemoryError: GC overhead limit exceeded
我已经广泛记录了我们的麻烦here。
特别是我注意到的地方:
如果我直接从CL运行我的构建作为Java命令,那么' - 优化shrinksafe“切换,它失败,但没有它成功。(单独使用internStrings运行它似乎会导致其他错误。)
不确定该怎么做,因为我认为oprtimize默认值 收缩,但我确定了以下内容:
WORKS:
c:\ temp \ dojo-release-1.7.3rc1-src \ util \ buildscripts> java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl = .. / .. / dojo load = build -p C:产生\一般\ comComplete.profile.js \公司\建立\头\编译\ --action release --releaseDir C:\ company \ builds \ head \ build \ generated \ general \ htdocs \ company \ javascript \ 1420
BROKEN(内存不足错误):
c:\ temp \ dojo-release-1.7.3rc1-src \ util \ buildscripts> java -Xms256m -Xmx256m -cp ../shrinksafe/js.jar;../closureCompiler/compiler.jar;../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main ../../dojo/dojo.js baseUrl = .. / .. / dojo load = build -p C:产生\一般\ comComplete.profile.js \公司\建立\头\编译\ --action release --releaseDir C:\ company \ builds \ head \ build \ generated \ general \ htdocs \ company \ javascript \ 1420 --optimize shrinksafe --internStrings true
不幸的是,以下ant脚本目标继续失败 记忆错误:
BuildNum:$ {buildNum}
<path id="js.path"> <pathelement location="${basedir}"/> </path> <pathconvert targetos="unix" property="js.path.unix" refid="js.path"
/&GT; js.path.unix:$ {js.path.unix}
<!-- clean unpack and output dirs --> <delete
dir =“$ {outputDir} / htdocs / company / javascript / src /”/&gt;
<copy file="${externalDir}/dojo/companyComplete.profile.js"
tofile =“$ {outputDir} /companyComplete.profile.js”filtering =“yes” 覆盖= “是” &GT;
<java fork="true" dir="${outputDir}/htdocs/company/javascript/src/util/buildscripts" classname="org.mozilla.javascript.tools.shell.Main"
failonerror = “真” &GT; - &GT; - &GT; - &GT; - &GT;
更新1
我也尝试过:
<jvmarg value="-Xms5120m"/>
<jvmarg value="-Xmx5120m"/>
并且还使用ant java任务本身的maxmemory
设置。
答案 0 :(得分:3)
最后发现问题,releaseDir开关值中有windows和unix文件分隔符。过去在Dojo中工作得很好&lt; 1.6并且通常Java没有问题。出于某种原因,在这种情况下,Dojo 1.7构建系统会遇到内存问题。
releaseDir在解决了问题中的蚂蚁令牌后,混合了unix和windows文件分隔符:
<arg value="releaseDir=${output.dir}/path/foo/bar" />
-> Became ->
releaseDir=blah\blah\blah/path/foo/bar
这足以导致构建锁定'写入资源',然后崩溃'堆空间'。 (这通常是Java无需处理的问题)。
修复很简单:
<path id="dojo.output.tmp">
<pathelement location=" ${output.dir}/path/foo/bar "/>
</path>
<pathconvert targetos="unix" property="dojo.output.dir" refid="dojo.output.tmp" />
...
<arg value="releaseDir=${dojo.output.dir}" />