简体   繁体   中英

Better way to handle OutOfMemoryError: Java heap space in SonarQube Compute Engine

I'm having a huge maven project on which the SonarQube analysis is been done, from maven everything is fine but the SonarQube background task fails because of OutOfMemoryError exception.

I have increased the heap memory for compute engine and its working for now, but is there a way to handle this in SonarQube without increasing the memory, like split the background task in to smaller tasks and combine the results?

The Compute Engine needs to load all data included in the report sent by the scanner in memory to be able to process it.

You can see in the log of the scanner the size of the report, to get a rough idea of how much data there is to process. It will of course be related to how many lines of source code is being analyzed.

[INFO] Analysis report generated in 3282ms, dir size=53 MB
[INFO] Analysis reports compressed in 5909ms, zip size=28 MB
[INFO] Analysis report uploaded in 3252ms

There is currently no way to have the scanner send fragments of the report. You can analyze for example different modules of the project separately, but this will result in different projects being created in SonarQube.

Increasing the heap size is a good solution, and using 1GB seems perfectly reasonable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM