我正在尝试分析一个(大约90万行代码)C#项目,它在早期版本的SonarQube(5.4)中运行良好但现在失败了(参见下面的stacktrace)。
我已经尝试为ComputeEngine分配更多内存(在5.4中这似乎与主应用程序共享资源)但仍然得到相同的错误:
sonar.ce.javaOpts=-Xmx1G -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
(来自:$SONAR_HOME\conf\sonar.properties
)
我需要做什么建议?
堆栈跟踪:
2016.12.28 12:13:18 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=338ms
2016.12.28 12:15:51 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVlFV-iVMj2WmfjY00WT
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:3664) ~[na:1.8.0_111]
at java.lang.String.<init>(String.java:207) ~[na:1.8.0_111]
at java.lang.StringBuilder.toString(StringBuilder.java:407) ~[na:1.8.0_111]
at org.sonar.server.computation.step.DuplicationDataMeasuresStep$DuplicationVisitor.createXmlDuplications(DuplicationDataMeasuresStep.java:104) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.step.DuplicationDataMeasuresStep$DuplicationVisitor.computeDuplications(DuplicationDataMeasuresStep.java:84) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.step.DuplicationDataMeasuresStep$DuplicationVisitor.visitFile(DuplicationDataMeasuresStep.java:79) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitNode(DepthTraversalTypeAwareCrawler.java:79) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:51) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.step.DuplicationDataMeasuresStep.execute(DuplicationDataMeasuresStep.java:66) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:75) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:81) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:56) ~[sonar-server-5.6.4.jar:na]
at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35) ~[sonar-server-5.6.4.jar:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_111]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_111]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_111]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_111]
2016.12.28 12:15:51 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=xxx.xxx.xxx.xxx.xxx | type=REPORT | id=AVlFV-iVMj2WmfjY00WT | time=244116ms
答案 0 :(得分:1)
在sonar.ce.javaOpts=-Xmx3G -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
中设置$SONAR_HOME\conf\sonar.properties
就可以了。