web-dev-qa-db-fra.com

GC Overhead Limit dépassé lors de l'exécution du coureur de sondeur

J'obtiens OutOfMemoryException lors de l'analyse de sonar sur mon projet. Voici la trace de la pile:

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)

J'ai essayé d'augmenter la mémoire mais le problème persiste. J'ai utilisé les options suivantes lors de l'exécution de sonar: set SONAR_RUNNER_OPTS=-Xmx1024m -XX:MaxPermSize=512m

26
Yasin

OK, après avoir fait plus de recherches, j'ai bien compris. J'ai dû faire une configuration, cependant.

  1. Ignorer l'analyse de la conception du package, sonar.skipPackageDesign=true
  2. Supprimez les entrées du répertoire lib/test dans le fichier de propriétés de votre projet
  3. Donnez plus de mémoire set SONAR_RUNNER_OPTS=-Xmx1536m -XX:MaxPermSize=512m
  4. Vous pouvez éventuellement désactiver l'analyse de conception en utilisant sonar.skipDesign=true
  5. Redémarrez les services SonarQube et vous devriez être bon maintenant :)

Pour en savoir plus, veuillez consulter ce message

15
Yasin