2016-12-28 53 views
0

我試圖分析一個在早期版本的SonarQube(5.4)中運行良好但現在失敗(參見下面的堆棧跟蹤)的C#項目(大〜900k行代碼)。SonarQube中的OutOfMemoryError 5.6.4

我試圖分配更多的內存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

我認爲你應該爲Xmx使用更大的值,這是聲納將用於完成任務的最大內存量 – Tony

+0

好的,我會進一步提高這個值。雖然默認情況下似乎是512米。似乎很奇怪,我需要超過默認設置的兩倍。 – Alix

回答

1

$SONAR_HOME\conf\sonar.properties設置sonar.ce.javaOpts=-Xmx3G -Xms512m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true的伎倆。