Java heap space error solutions

Hello,

I have been recently getting the error " java.lang.OutOfMemoryError: Java heap space" on a few different projects I’m analyzing. To fix this, I’ve been steadily increasing the “SONAR_SCANNER_OPTS” value. This works in the moment, but it seems like the next week I run into the same issue again.

I’m wondering if there’s any other way to address this besides increasing the “SONAR_SCANNER_OPTS” value. Are there other settings in SQ we can use to free up memory, or do we just need to keep increasing “SONAR_SCANNER_OPTS”? Thank you.

Hi,

Probably you need to increase that value. Since each analysis is a new process, I’m not sure there’s anything to “free up” (unless it’s a question of available resources on the build agent…).

At the same time, would you mind sharing details like:

  • language(s)
  • SonarQube version
  • scanner flavor

 
Thx,
Ann

I think you’re right in that it might be related to resources available on the build agent, since I’m realizing the SONAR_SCANNER_OPTS value now exceeds the free space available. So I’m thinking we may need to increase the memory on the server.

Language: JavaScript
SonarQube version: Sonarqube:8.9-community
Scanner flavor: I’m not 100% sure what the answer to this is, although I use the github action here: Official SonarQube Scan · Actions · GitHub Marketplace · GitHub, and the logs say: SonarScanner 4.6.2.2472

1 Like

Hi,

Okay, so come back to us if you still have a problem after you’ve beefed-up the build agent.

 
:+1:
Ann

1 Like