声纳findbugs堆大小 [英] sonar findbugs heap size

查看:70
本文介绍了声纳findbugs堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是声纳的新手.我从詹金斯(Jenkins)用声纳普尔金(Pulgin)运行声纳.

当我从詹金斯(Jenkins)运行时,我发现findbugs内存不足异常

以下是错误:

 Out of memory
Total memory: 1037M
 free memory: 30M
Analyzed: D:\Victor\autocreated\webapp\WEB-INF\classes
     Aux: C:\DOCUME~1\NADBHA~1\LOCALS~1\Temp\findbugs4165854405681394173.jar
     Aux: C:\DOCUME~1\NADBHA~1\LOCALS~1\Temp\findbugs4688505485649811865.jar
Total time: 2:04:49.155s
Final Memory: 358M/989M
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.api.utils.SonarException: Can not execute Findbugs
    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: org.sonar.api.utils.SonarException: Can not execute Findbugs
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:120)
    at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:58)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
    at org.sonar.batch.phases.Phases.execute(Phases.java:93)
    at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
    at org.sonar.batch.bootstrap.Module.start(Module.java:83)
    at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:111)
    at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:101)
    at org.sonar.batch.bootstrap.Module.start(Module.java:83)
    at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:102)
    at org.sonar.batch.bootstrap.Module.start(Module.java:83)
    at org.sonar.batch.Batch.execute(Batch.java:100)
    at org.sonar.runner.Launcher.executeBatch(Launcher.java:65)
    at org.sonar.runner.Launcher.execute(Launcher.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonar.runner.Runner.delegateExecution(Runner.java:186)
    ... 2 more
Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:112)
    ... 20 more
Caused by: java.lang.OutOfMemoryError: Java heap space

我的声纳版本是2.13

当我将Jenkins声纳插件中的jvm选项增加到1280时,显示如下错误:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit`enter code here`

解决方案

是的,如果所分析的代码库很大,声纳findbugs执行程序可以使用大量RAM.

您不仅必须增加可用于JVM的堆大小,而且还必须增加" MaxPermSize "和" ReservedCodeCacheSize "(至少对于Java Hotspot VM).必须在实际执行FindBugs声纳执行器的JVM上设置JVM选项.因此,可能不是Jenkins VM,而是Jenkins开始从事这项工作的VM.

以下是64位系统的示例:

-Xmx3062m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m

在我假设您正在使用的32位系统上,您会选择较低的值,例如:

-Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=128m

此外,如果Jenkins不接受JVM选项,则可以尝试使用Jenkins的声纳蚂蚁任务运行声纳. (这就是我正在做的,我可以根据需要设置尽可能多的内存.)

i am new to sonar. i am running sonar from Jenkins with sonar pulgin.

When i am running from jenkins i am getting out of memory exception at findbugs

below is the error:

 Out of memory
Total memory: 1037M
 free memory: 30M
Analyzed: D:\Victor\autocreated\webapp\WEB-INF\classes
     Aux: C:\DOCUME~1\NADBHA~1\LOCALS~1\Temp\findbugs4165854405681394173.jar
     Aux: C:\DOCUME~1\NADBHA~1\LOCALS~1\Temp\findbugs4688505485649811865.jar
Total time: 2:04:49.155s
Final Memory: 358M/989M
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.api.utils.SonarException: Can not execute Findbugs
    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: org.sonar.api.utils.SonarException: Can not execute Findbugs
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:120)
    at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:58)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
    at org.sonar.batch.phases.Phases.execute(Phases.java:93)
    at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
    at org.sonar.batch.bootstrap.Module.start(Module.java:83)
    at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:111)
    at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:101)
    at org.sonar.batch.bootstrap.Module.start(Module.java:83)
    at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:102)
    at org.sonar.batch.bootstrap.Module.start(Module.java:83)
    at org.sonar.batch.Batch.execute(Batch.java:100)
    at org.sonar.runner.Launcher.executeBatch(Launcher.java:65)
    at org.sonar.runner.Launcher.execute(Launcher.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonar.runner.Runner.delegateExecution(Runner.java:186)
    ... 2 more
Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:112)
    ... 20 more
Caused by: java.lang.OutOfMemoryError: Java heap space

my sonar version is 2.13

when i am increasing the jvm options in Jenkins sonar plugin to 1280 it is shown below error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit`enter code here`

解决方案

Yes, the sonar findbugs executor can use a lot of RAM if the analyzed code base is large.

You will have to increase not only the heap size available to the JVM, but also "MaxPermSize" and "ReservedCodeCacheSize" (at least for the Java Hotspot VM). The JVM options must be set on the JVM which is actually executing the FindBugs sonar executor. So probably not the Jenkins VM, but the one that Jenkins starts for the job.

Here's an example for a 64bit system:

-Xmx3062m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m

On a 32bit system, which I am assuming you are using, you would go for lower values, such as:

-Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=128m

Also, if Jenkins won't accept the JVM options, you can try running sonar using the sonar ant task from Jenkins. (That's what I am doing, and I can set as much memory as I like.)

这篇关于声纳findbugs堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆