简体   繁体   English

SonarQube - 奇怪的OutOfMemoryError:PermGen空间

[英]SonarQube - strange OutOfMemoryError: PermGen space

I know that there are similar questions out here, but none seems to provide a solution, so I hope that my setting is somewhat different, so that there may be a solution at least for this specific problem: 我知道这里有类似的问题,但似乎没有提供解决方案,所以我希望我的设置有所不同,所以至少对于这个特定的问题可能有一个解决方案:

For some reasons we are stuck to SonarQube 4.5.6 at the moment, trying to analyse a huge Java project (12.000 files with about 1.000.000 lines of code). 出于某些原因,我们现在仍然坚持使用SonarQube 4.5.6,试图分析一个巨大的Java项目(12.000个文件,大约有1.000.000行代码)。 The rule set consists of about 700 rules spread over the java-plugin (latest version 3.11), findbugs (latest version 3.3), checkstyle (need to use an older version here - 2.2, cause of some rules not available in later versions), and pmd (latest version 2.5). 规则集包含大约700条规则,分布在java-plugin(最新版本3.11),findbugs(最新版本3.3),checkstyle(需要使用旧版本 - 2.2,导致某些规则在以后的版本中不可用),和pmd(最新版本2.5)。

With Sonar Runner 2.4 the parts of java-plugin, findbugs (with a timeout set to about 20 minutes), checkstyle run through, but within pmd I keep getting an OutOfMemoryError: PermGen space 使用Sonar Runner 2.4 java-plugin的部分,findbugs(超时设置为大约20分钟),checkstyle运行,但在pmd内我不断得到一个OutOfMemoryError:PermGen空间

17:56:31.276 INFO  - Sensor PmdSensor...
17:56:31.279 INFO  - Execute PMD 5.4.0...
17:56:31.313 INFO  - Java version: 1.5
17:56:31.360 INFO  - PMD configuration: C:\src\.\.sonar\pmd.xml
17:57:23.679 INFO  - Execute PMD 5.4.0 done: 52400 ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 57:33.538s
Final Memory: 47M/3908M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        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: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at net.sourceforge.pmd.lang.java.typeresolution.PMDASMClassLoader.loadClass(PMDASMClassLoader.java:65)
        at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.populateType(ClassTypeResolver.java:655)
        at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:179)
        at net.sourceforge.pmd.lang.java.ast.ASTImportDeclaration.jjtAccept(ASTImportDeclaration.java:62)
        at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.childrenAccept(AbstractJavaNode.java:55)
        at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:9)
        at net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:136)
        at net.sourceforge.pmd.lang.java.typeresolution.ClassTypeResolver.visit(ClassTypeResolver.java:170)
        at net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit.jjtAccept(ASTCompilationUnit.java:42)
        at net.sourceforge.pmd.lang.java.typeresolution.TypeResolutionFacade.initializeWith(TypeResolutionFacade.java:17)
        at net.sourceforge.pmd.lang.java.AbstractJavaHandler$5.start(AbstractJavaHandler.java:88)
        at net.sourceforge.pmd.SourceCodeProcessor.usesTypeResolution(SourceCodeProcessor.java:127)
        at net.sourceforge.pmd.SourceCodeProcessor.processSource(SourceCodeProcessor.java:142)
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:76)
        at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:43)
        at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:82)
        at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:120)
        at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:90)
        at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:75)
        at org.sonar.plugins.pmd.PmdSensor.analyse(PmdSensor.java:67)

The stack trace says I'm still in pmd, but the pmd seems to have already been through analysis (line Execute PMD 5.4.0 done: ... ), and there shouldn't be another plug-in running thereafter. 堆栈跟踪说我还在pmd,但pmd似乎已经通过分析( Execute PMD 5.4.0 done: ... ),此后不应再运行其他插件。 Nevertheless, I wonder where I should increase the PermGen space ... I already have 不过,我想知道我应该在哪里增加PermGen空间......我已经拥有了

wrapper.java.additional.2=-XX:MaxPermSize=8g
wrapper.java.maxmemory=8g

in wrapper.conf and also tried to add wrapper.conf也尝试添加

set JAVA_OPTS="-XX:PermSize=256m -XX:MaxPermSize=4096m"

in sonar-runner.bat . sonar-runner.bat In addition there's 另外还有

sonar.web.javaOpts=-server -Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 

in sonar.properties . sonar.properties First, I don't understand which setting is the one responsible for the OutOfMemoryError - the one in wrapper.conf ? 首先,我不明白哪个设置是负责OutOfMemoryError - wrapper.conf the one in sonar-runner.bat ? sonar-runner.bat的一个? or sonar.properties ? 还是sonar.properties

What can I do when PermSize of 8g isn't helping?? 8g PermSize没有帮助时,我该怎么办? The default size is 128m or something, so it's already a factor of 64!? 默认大小是128m或者其他东西,所以它已经是64的因素!?

Any idea, how to analyse this project with SonarQube? 有什么想法,如何用SonarQube分析这个项目? The problem occurs as well with the built-in database as with a MySQL, so I don't think that that has any influence. 与MySQL一样,内置数据库也会出现问题,所以我认为这没有任何影响。

Any help appreciated. 任何帮助赞赏。 Thanks ... if you need any more info about configuration or have an idea to get some more infos out of some logs, please let me know. 谢谢...如果您需要有关配置的更多信息或想要从某些日志中获取更多信息,请告诉我们。

You need to allocate the extra memory not on the server side, but on the analysis side to the process that runs the analysis. 您需要在服务器端分配额外的内存,而在分析端分配额外的内存以运行分析。 Since you appear to be analyzing using the SonarQube Scanner, I'll direct you to the Troubleshooting section of those docs, where it tells you how to adjust the memory settings for the process by exporting a SONAR_RUNNER_OPTS env var. 由于您似乎正在使用SonarQube扫描仪进行分析,因此我将引导您访问这些文档的“ 故障排除”部分,其中介绍了如何通过导出SONAR_RUNNER_OPTS env var来调整流程的内存设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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