2
votes

I am using jenkins for making build by using Ant. I am also configuring sonar on this jenkins job via 'Invoke Standalone Sonar Analysis". Everything is going fine till build making process and build successfully created. Now sonar execution is started and after some time i got an error

"Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: java.lang.OutOfMemoryError: Java heap space

Build step 'Invoke Standalone Sonar Analysis' marked build as failure "...

What all i have done to fix this issue are:

  1. Increasing java heap size via

    Replaced %SONAR_RUNNER_OPTS% with -Xms256m -Xmx1024m in sonar-runner.bat file of sonar.

  2. Modify Sonar_Way quality profile and put only one or two rules active in this so that to avoid rule voilation.

then run build but still getting same java heap error. One more thing i would add on this is my project source folder size is around 40mb means its a big project comparatively.

Can anyboby help me out on this?? What else should i do to get this done. Your revert will be appreciable.. Thanks in Advance..

1
Can you copy-paste the part of the log where the analysis fails with the OOMError? Also, can you detail more your Sonar configuration? (version, plugins that you use, ...etc) And lastly: is your project a multi-module project or a single module project? (40Mb of sources is really huge for a single module project)Fabrice - SonarSource Team
Hi Fabrice, below are the error logs and sonar details you are asking for..shekhar verma
11:40:53.371 INFO p.PhasesTimeProfiler - Execute decorators... Total time: 9:42.926s Final Memory: 20M/247M Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: java.lang.OutOfMemoryError: Java heap space at org.sonar.runner.Runner.delegateExecution(Runner.java:189) at org.sonar.runner.Runner.execute(Runner.java:78) at org.sonar.runner.Main.main(Main.java:61) Caused by: java.lang.OutOfMemoryError: Java heap space at java.util.ArrayList.<init>(ArrayList.java:112)shekhar verma
OTHER DETAILS......sonar configuration and pluign details-- sonar-version--3.2 plugins m suing are: 1.pdf-report-plugin 2.build-breaker-plugin 3.branding-plugin 4.jira-plugin 5.quality-index-plugin 6.technicaldebt-plugin 7.web-plugin and this project have only one moduleshekhar verma

1 Answers

2
votes

Here are some other things you can try:

  • Remove all the following addionnal plugins: PDF, build-breaker, quality-index, technical debt. And try a new analysis.

  • Increase again the Java heap size (-Xms512m -Xmx1024m)

  • Use "sonar.exclusions" to exclude parts of your code, and see the max amount of source code that you can analyse at once without failing

  • Split your big project into small modules and use the multi-module feature of Sonar