我正在尝试对Azure Devops中的构建管道进行旁听。在SonarQube发布步骤中,a收到以下错误:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.String.<init>(String.java:166)
at org.apache.commons.codec.binary.Hex.encodeHexString(Hex.java:161)
at org.sonar.core.hash.SourceLinesHashesComputer.computeHash(SourceLinesHashesComputer.java:63)
at org.sonar.core.hash.SourceLinesHashesComputer.addLine(SourceLinesHashesComputer.java:51)
at org.sonar.server.computation.task.projectanalysis.source.ComputeFileSourceData.read(ComputeFileSourceData.java:54)
at org.sonar.server.computation.task.projectanalysis.source.ComputeFileSourceData.compute(ComputeFileSourceData.java:48)
at org.sonar.server.computation.task.projectanalysis.step.PersistFileSourcesStep$FileSourceVisitor.visitFile(PersistFileSourcesStep.java:120)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitNode(DepthTraversalTypeAwareCrawler.java:79)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:51)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
at org.sonar.server.computation.task.projectanalysis.step.PersistFileSourcesStep.execute(PersistFileSourcesStep.java:89)
at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)
at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)
at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:73)
at org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:134)
at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:97)
at org.sonar.ce.taskprocessor.CeWorkerImpl$$Lambda$739/1000704267.get(Unknown Source)
at org.sonar.ce.taskprocessor.CeWorkerImpl.withCustomizedThreadName(CeWorkerImpl.java:81)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:73)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:43)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
我尝试按照此处的建议设置SONAR_SCANNER_OPTS
:https://community.sonarsource.com/t/sonarqube-error-gc-overhead-limit-exceeded/12624/2(我将其作为环境变量添加到了管道中),但这没有用。即使尺寸更大。
有什么建议吗?
答案 0 :(得分:0)
如果您使用Maven或ANT任务运行Sonar。设置SONAR_SCANNER_OPTS环境变量可能无法正常工作。
由于Maven / ANT任务将执行运行Sonar分析,因此您需要为Maven / Ant设置JVM堆空间。
对于Maven:您应该设置MAVEN_OPTS
环境变量。您可以将其作为环境变量添加到管道中。
或者您可以在Maven任务的高级设置下更改MAVEN_OPTS值。参见下面的屏幕截图:
对于ANT:您应该通过将ANT_OPTS
环境变量(例如export ANT_OPTS=-Xmx256m
)作为环境变量添加到管道中来进行设置。
选中类似的thread,以获取更多信息。