Out of memory: Java heap space

xml

(Ryan K) #1

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
  • Community Edition Version 7.4 (build 18908)

I am using Team City as my CI.
SQ is being hosted in a Win Server 2012 R2. 12 gb of Ram. I have more than 50gig free.
When I have task manager RAM only 40% used

I have added several projects to SonarQube. Only a couple of project i encounter " Out of memory: Java heap space"

Below is the error message I get

 	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: java.lang.OutOfMemoryError: Java heap space
 	at java.util.Arrays.copyOf(Arrays.java:3332)
 	at java.lang.StringCoding.safeTrim(StringCoding.java:89)
 	at java.lang.StringCoding.access$100(StringCoding.java:50)
 	at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:154)
 	at java.lang.StringCoding.decode(StringCoding.java:193)
 	at java.lang.String.<init>(String.java:414)
 	at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:245)
 	at org.sonar.api.batch.fs.internal.DefaultInputFile.contents(DefaultInputFile.java:101)
 	at org.sonar.plugins.xml.compat.CompatibleInputFile.contents(CompatibleInputFile.java:64)
 	at org.sonar.plugins.xml.highlighting.XMLHighlighting.<init>(XMLHighlighting.java:50)
 	at org.sonar.plugins.xml.XmlSensor.runChecks(XmlSensor.java:102)
 	at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:151)
 	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:45)
 	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:88)
 	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:62)
 	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74)
 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:164)
 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
 Final Memory: 9M/247M
 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:319)
 INFO: ------------------------------------------------------------------------
 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:314)
 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:288)
 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
 	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
 	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:82)
 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
 	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:131)
 	at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
 	at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
 
 Process exited with code 1

Error: Cannot find module 'typescript'
(G Ann Campbell) #2

Hi,

Would you mind adding your list of plugins and their versions, please? You can find them in Administration > Marketplace.

 
Thx,
Ann


(Ryan K) #3

Hi Ann

I do not see where the version are for the installed. I did put a screen shot on what is currently available to update.
I can not upload multiple files as a new user.


(Ryan K) #4


(Ryan K) #5


(G Ann Campbell) #6

Hi,

You’re really close to where you need to be. Take a look at the 2nd column from the left on the All tab:

 
Ann


(Ryan K) #7

Lets try this again. I serious

staring to hate this limitation of upload


(Ryan K) #8


(Ryan K) #9


(Ryan K) #10


(Ryan K) #11


(Ryan K) #12


(Ryan K) #13

Done


(Michael Gumowski) #16

Hey @RyanK,

Thanks for the feedback. It seems to me that the SonarXML analyzer is exploding while trying to highlight some files.

I suspect that we are actually badly handling very big files, making copies in memory. In order to investigate the issue, I would appreciate if you could answer the following questions:

  • Are you analyzing enormous XML file? (several/dozens MB)
  • If yes, could you provide (privately if needed) an example of one of this file?

As a temporary workaround, you could try to exclude very big XML files from analysis. It would allow your analysis to passes.

Cheers,
Michael