[英]SonarQube java.lang.OutOfMemoryError: GC overhead limit exceeded
I am getting OutOfMemoryException
while performing sonar analysis on my project. 我在对项目进行声纳分析时遇到
OutOfMemoryException
。 Jenkins job shows analysis report was generated successfully but during background task in SonarQube
it is failing with below exception., Jenkins作业显示分析报告已成功生成,但在
SonarQube
后台任务期间,它失败,但有以下异常。
2016.08.24 10:55:52 INFO [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=14ms
2016.08.24 10:56:01 INFO [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=9075ms
2016.08.24 10:56:02 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=150ms
2016.08.24 10:56:34 ERROR [o.s.s.c.c.ComputeEngineContainerImpl] Cleanup of container failed
java.lang.OutOfMemoryError: GC overhead limit exceeded
2016.08.24 10:56:34 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVa6eX7gdswG1hqK_Vvc
java.lang.OutOfMemoryError: Java heap space
2016.08.24 10:56:34 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=iServe | id=AVa6eX7gdswG1hqK_Vvc | time=53577ms
I know this late, but might help someone : 我知道这很晚,但可能会帮助某人:
Try to increase MaxPermSize 尝试增加MaxPermSize
I have these configurations under respective JVM Options (web/ce/Elastic search) of sonar.properties file :- 我在sonar.properties文件的相应JVM选项 (web / ce / Elastic搜索)下有这些配置: -
sonar.web.javaOpts =-Xmx8512m -Xms512m -XX:MaxPermSize=1024m / sonar.ce.javaOpts =-Xmx8512m -Xms512m -XX:MaxPermSize=1024m / sonar.search.javaOpts =-Xmx8512m -Xms512m -XX:MaxPermSize=1024m
sonar.web.javaOpts = -Xmx8512m -Xms512m -XX:MaxPermSize = 1024m / sonar.ce.javaOpts = -Xmx8512m -Xms512m -XX:MaxPermSize = 1024m / sonar.search.javaOpts = -Xmx8512m -Xms512m -XX:MaxPermSize = 1024m
For me, it actually worked with '1024m', just because I had multiple modules in my project and just as a hint my server as well need same size for deployments. 对我来说,它实际上与'1024m'一起使用,只是因为我在我的项目中有多个模块,只是作为一个提示我的服务器也需要相同的部署大小。
I use docker-compose and this option works perfectly for me. 我使用docker-compose,这个选项适合我。
version: "2"
services:
sonarqube:
image: sonarqube
command: -Dsonar.ce.javaOpts=-Xmx4096m
You can costumize the memory size. 您可以花费内存大小。
Hi i solved this problem in two ways for two different scenarios where i found this issue 嗨,我在两个不同的场景中以两种方式解决了这个问题,我发现了这个问题
Case : when using jenkins :: I was also facing this problem some time ago, my sonar analysis worked fine on command line but it failedon jenkins, you can replace %SONAR_RUNNER_OPTS% with -Xms256m -Xmx1024m to increase the heap size in sonar-runner bat file. 案例:当使用jenkins时::我前面也遇到过这个问题,我的声纳分析在命令行上工作正常但是jenkins失败了,你可以用-Xms256m -Xmx1024m替换%SONAR_RUNNER_OPTS%以增加声纳 - 跑步者的堆大小蝙蝠文件
Case : when using command line :: i also got this errorsometimes when i was using cmd line to run sonar analysis , in which cas the solution is to create more number of modules, it somehow works and i dont get java out of mem error. 案例:当使用命令行::我也使用cmd行来运行声纳分析时出现这种错误,其中cas解决方案是创建更多数量的模块,它以某种方式工作,我不会让java忘记错误。
For Linux systems : Edit ./sonar-scanner-2.6.1/bin/sonar-runner file and add 对于Linux系统:编辑./sonar-scanner-2.6.1/bin/sonar-runner文件并添加
SONAR_SCANNER_OPTS="$SONAR_SCANNER_OPTS -Xmx2048m -XX:MaxPermSize=1024m"
**Note:- SONAR_RUNNER_OPTS is deprecated**.
if [ -n "$SONAR_RUNNER_OPTS" ] ;
then
echo WARN: '$SONAR_RUNNER_OPTS' is deprecated. Please use '$SONAR_SCANNER_OPTS' instead.
Hope it helps :) 希望能帮助到你 :)
我遇到了类似的问题,并在JVM选项中添加了-Xmx2048m -XX: MaxPermSize = 1024m
,扫描过程顺利进行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.