我已经在我的 GWT 项目上进行 mvn clean install 几个月了,现在它坏了。我得到以下堆栈跟踪:
[INFO] Compiling 3 permutations
[INFO] Compiling permutation 1...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 0...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 2...
[INFO] [ERROR] StackOverflowError: Increase stack size
[INFO] java.lang.StackOverflowError
[INFO] at java.lang.StringBuffer.append(StringBuffer.java:322)
[INFO] at java.io.StringWriter.write(StringWriter.java:94)
[INFO] at java.io.PrintWriter.write(PrintWriter.java:426)
[INFO] at java.io.PrintWriter.write(PrintWriter.java:443)
[INFO] at java.io.PrintWriter.print(PrintWriter.java:587)
[INFO] at com.google.gwt.dev.util.AbstractTextOutput.printAndCount(AbstractTextOutput.java:148)
[INFO] at com.google.gwt.dev.util.AbstractTextOutput.print(AbstractTextOutput.java:107)
[INFO] at com.google.gwt.dev.js.JsToStringGenerationVisitor._nameRef(JsToStringGenerationVisitor.java:1190)
[INFO] at com.google.gwt.dev.js.JsToStringGenerationVisitor.visit(JsToStringGenerationVisitor.java:723)
[INFO] at com.google.gwt.dev.js.ast.JsNameRef.traverse(JsNameRef.java:117)
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.doTraverse(JsVisitor.java:468)
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.doAccept(JsVisitor.java:445)
[INFO] at com.google.gwt.dev.js.JsSourceGenerationVisitorWithSizeBreakdown.generateAndBill(JsSourceGenerationVisitorWithSizeBreakdown.java:119)
[INFO] at com.google.gwt.dev.js.JsReportGenerationVisitor.generateAndBill(JsReportGenerationVisitor.java:58)
[INFO] at com.google.gwt.dev.js.JsSourceGenerationVisitorWithSizeBreakdown.doAccept(JsSourceGenerationVisitorWithSizeBreakdown.java:96)
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.accept(JsVisitor.java:109)
[INFO] at com.google.gwt.dev.js.JsToStringGenerationVisitor.visit(JsToStringGenerationVisitor.java:672)
[INFO] at com.google.gwt.dev.js.ast.JsInvocation.traverse(JsInvocation.java:69)
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.doTraverse(JsVisitor.java:468)
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.doAccept(JsVisitor.java:445)
如你所见,我只有 3 种排列。输出的最后几行(
com.google.gwt.dev.js
的东西)重复了数十次(我没有粘贴所有内容),这让我认为这可能与某些无限循环有关。
打印堆栈溢出错误后,我得到堆栈跟踪的其余部分,如下所示:
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.accept(JsVisitor.java:109)
[INFO] at com.google.gwt.dev.js.JsToStringGenerationVisitor.visit(JsToStringGenerationVisitor.java:325)
[INFO] at com.google.gwt.dev.js.ast.JsBinaryOperation.traverse(JsBinaryOperation.java:112)
[INFO] at com.google.gwt.dev.js.ast.JsVisitor.doTraverse(JsVisitor.java:468)
[INFO] [ERROR] Stack overflow; to increase the stack size, use the -Xss flag at startup (java -Xss1M ...)
[INFO] [ERROR] Unrecoverable exception, shutting down
[INFO] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
[INFO] at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:60)
[INFO] at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:73)
[INFO] at java.lang.Thread.run(Thread.java:722)
[INFO] [ERROR] Not all permutation were compiled , completed (0/3)
[INFO] [WARN] Lost communication with remote process
[INFO] java.net.SocketException: socket closed
[INFO] at java.net.SocketInputStream.socketRead0(Native Method)
[INFO] at java.net.SocketInputStream.read(SocketInputStream.java:150)
[INFO] at java.net.SocketInputStream.read(SocketInputStream.java:121)
[INFO] at java.net.SocketInputStream.read(SocketInputStream.java:203)
[INFO] at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2266)
[INFO] at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2559)
[INFO] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2569)
[INFO] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1315)
[INFO] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
[INFO] at com.google.gwt.dev.ExternalPermutationWorkerFactory$ExternalPermutationWorker.compile(ExternalPermutationWorkerFactory.java:152)
[INFO] at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:73)
[INFO] at java.lang.Thread.run(Thread.java:722)
[INFO] [WARN] Lost communication with remote process
[INFO] java.net.SocketException: socket closed
[INFO] at java.net.SocketInputStream.socketRead0(Native Method)
有人可以帮助我吗?
我们必须为 GWT-Maven-Plugin 配置中的 JVM 参数设置更高的值。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt-maven-plugin.version}</version>
<executions>
<execution>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
</configuration>
...
就是这样。