web-dev-qa-db-ja.com

ソナーランナーの実行中にGCオーバーヘッド制限を超えました

プロジェクトでソナー分析を実行しているときにOutOfMemoryExceptionが発生します。以下はスタックトレースです。

14:55:55.433 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@5a7b5cb8[id=1,key=myProj_web,qualifier=TRK], with key batch-myProj_web
14:55:55.711 DEBUG - To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 12:48.979s
Final Memory: 33M/910M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.Java:91)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.Java:75)
        at Java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.Java:69)
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.Java:50)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.Java:102)
        at org.sonar.runner.api.Runner.execute(Runner.Java:100)
        at org.sonar.runner.Main.executeTask(Main.Java:70)
        at org.sonar.runner.Main.execute(Main.Java:59)
        at org.sonar.runner.Main.main(Main.Java:53)
Caused by: org.sonar.api.utils.SonarException: Can not execute Findbugs
        at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.Java:154)
        at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.Java:59)
        at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.Java:79)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.Java:70)
        at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.Java:131)
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.Java:178)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.Java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.Java:77)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.Java:199)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.Java:194)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.Java:187)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.Java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.Java:77)
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.Java:56)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.Java:44)
        at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.Java:82)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.Java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.Java:77)
        at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.Java:175)
        at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.Java:163)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.Java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.Java:77)
        at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.Java:92)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.Java:74)
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.Java:48)
        at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:39)
        at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:25)
        at Java.lang.reflect.Method.invoke(Method.Java:597)
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.Java:87)
        ... 9 more
Caused by: Java.util.concurrent.ExecutionException: Java.lang.OutOfMemoryError: GC overhead limit exceeded
        at Java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.Java:232)
        at Java.util.concurrent.FutureTask.get(FutureTask.Java:91)
        at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.Java:146)
        ... 38 more
Caused by: Java.lang.OutOfMemoryError: GC overhead limit exceeded
        at edu.umd.cs.findbugs.util.Strings.escapeXml(Strings.Java:167)
        at edu.umd.cs.findbugs.xml.XMLAttributeList.getQuotedAttributeValue(XMLAttributeList.Java:132)
        at edu.umd.cs.findbugs.xml.XMLAttributeList.toString(XMLAttributeList.Java:111)
        at edu.umd.cs.findbugs.xml.OutputStreamXMLOutput.openTag(OutputStreamXMLOutput.Java:112)
        at edu.umd.cs.findbugs.SourceLineAnnotation.writeXML(SourceLineAnnotation.Java:887)
        at edu.umd.cs.findbugs.ClassAnnotation.writeXML(ClassAnnotation.Java:192)
        at edu.umd.cs.findbugs.BugInstance.writeXML(BugInstance.Java:2292)
        at edu.umd.cs.findbugs.SortedBugCollection.writeXML(SortedBugCollection.Java:576)
        at edu.umd.cs.findbugs.SortedBugCollection.writeXML(SortedBugCollection.Java:497)
        at edu.umd.cs.findbugs.XMLBugReporter.finish(XMLBugReporter.Java:46)
        at edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.Java:81)
        at edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.Java:81)
        at edu.umd.cs.findbugs.DelegatingBugReporter.finish(DelegatingBugReporter.Java:81)
        at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.Java:1256)
        at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.Java:282)
        at org.sonar.plugins.findbugs.FindbugsExecutor$FindbugsTask.call(FindbugsExecutor.Java:201)
        at Java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.Java:303)
        at Java.util.concurrent.FutureTask.run(FutureTask.Java:138)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.Java:886)
        at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:908)
        at Java.lang.Thread.run(Thread.Java:662)

メモリを増やしてみましたが、まだ問題は解決していません。ソナーの実行中に次のオプションを使用しました:set SONAR_RUNNER_OPTS=-Xmx1024m -XX:MaxPermSize=512m

26
Yasin

わかりました。さらに調査を行った結果、正しく理解できました。ただし、いくつかの設定を行う必要がありました。

  1. パッケージ設計分析をスキップします、sonar.skipPackageDesign=true
  2. プロジェクトのプロパティファイルのlib/testディレクトリのエントリを削除します
  3. もう少しメモリを追加してくださいset SONAR_RUNNER_OPTS=-Xmx1536m -XX:MaxPermSize=512m
  4. オプションで、sonar.skipDesign=trueを使用して設計分析を無効にすることができます
  5. SonarQubeサービスを再起動します。これで問題ありません。

詳細については、 この投稿を参照してください

15
Yasin