Sonarqube - java.lang.OutOfMemoryError:超出 GC 开销限制
Posted
技术标签:
【中文标题】Sonarqube - java.lang.OutOfMemoryError:超出 GC 开销限制【英文标题】:Sonarqube - java.lang.OutOfMemoryError: GC overhead limit exceeded 【发布时间】:2020-09-08 00:08:33 【问题描述】:SonarQube Environment:-
SonarQube Version - 6.7.7 LTS
sonar-cxx-plugin version -1.2.2.1653.jar
sonar-scanner version -3.0.3.778
Execution through Jenkins SonarQube Scanner section.
Jenkins SonarQube Analysis properties consists of below additionally
sonar.skipPackageDesign=true
sonar.skipDesign=true
sonar.ce.javaOpts=-Xmx1280m
sonar.web.javaOpts=-Xmx1280m
JVM Options-Xmx10240m -XX:MaxPermSize=1024m -Xms10240m
SonarQube 执行成功完成,但是它挂起并且在一段时间后存在以下错误。
15:25:10 15:29:09.683 WARN: Preprocessor: 159 include directive error(s). This is only relevant if parser creates syntax errors. The preprocessor searches for include files in the with 'sonar.cxx.includeDirectories' defined directories and order.
15:25:10 15:29:09.683 WARN: Source code parser: 1617 syntax error(s) detected. Syntax errors could cause invalid software metric values. Root cause are typically missing includes, missing macros or compiler specific extensions.
15:25:10 15:29:09.686 INFO: Task total time: 7.269 s
15:25:10 15:29:09.819 INFO: ------------------------------------------------------------------------
15:25:10 15:29:09.819 INFO: EXECUTION SUCCESS
15:25:10 15:29:09.819 INFO: ------------------------------------------------------------------------
15:25:10 15:29:09.819 INFO: Total time: 8.606s
15:25:10 15:29:09.908 INFO: Final Memory: 79M/9813M
15:25:10 15:29:09.908 DEBUG: Connection manager is shutting down
15:25:10 15:29:09.908 INFO: ------------------------------------------------------------------------
15:25:10 15:29:09.908 DEBUG: Connection manager shut down
15:31:27 FATAL: Remote call on SonarQube_Project_TLS_Modem failed
15:31:27 java.lang.OutOfMemoryError: GC overhead limit exceeded
15:31:27 Caused: java.io.IOException: Remote call on SonarQube_Project_TLS_Modem failed
15:31:27 at hudson.remoting.Channel.call(Channel.java:963)
15:31:27 at hudson.FilePath.act(FilePath.java:1070)
15:31:27 at hudson.FilePath.act(FilePath.java:1059)
15:31:27 at hudson.FilePath.list(FilePath.java:1893)
15:31:27 at hudson.FilePath.list(FilePath.java:1877)
15:31:27 at hudson.FilePath.list(FilePath.java:1862)
15:31:27 at hudson.plugins.sonar.utils.SonarUtils.extractReportTask(SonarUtils.java:89)
15:31:27 at hudson.plugins.sonar.utils.SonarUtils.addBuildInfoTo(SonarUtils.java:118)
15:31:27 at hudson.plugins.sonar.utils.SonarUtils.addBuildInfoTo(SonarUtils.java:134)
15:31:27 at hudson.plugins.sonar.SonarRunnerBuilder.perform(SonarRunnerBuilder.java:301)
15:31:27 at hudson.plugins.sonar.SonarRunnerBuilder.perform(SonarRunnerBuilder.java:247)
15:31:27 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
15:31:27 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
15:31:27 at hudson.model.Build$BuildExecution.build(Build.java:206)
15:31:27 at hudson.model.Build$BuildExecution.doRun(Build.java:163)
15:31:27 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
15:31:27 at hudson.model.Run.execute(Run.java:1818)
15:31:27 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
15:31:27 at hudson.model.ResourceController.execute(ResourceController.java:97)
15:31:27 at hudson.model.Executor.run(Executor.java:429)
Sonarqube 服务器sonar.log
没有任何错误。但是来自ce.log
日志文件的错误信息如下
15:35:26 Caused: java.io.IOException: Remote call on SonarQube_Project_TLS_Modem failed
15:35:26 at hudson.remoting.Channel.call(Channel.java:963)
在服务器 sonar.properties
上,CE,WEB & Elastic Search
具有以下配置
sonar.ce.javaOpts=-Xmx4G -Xms4G -XX:+HeapDumpOnOutOfMemoryError
sonar.web.javaOpts=-Xmx4G -Xms4G -XX:+HeapDumpOnOutOfMemoryError
sonar.search.javaOpts=-Xmx4G -Xms4G -XX:+HeapDumpOnOutOfMemoryError
由于执行成功完成,我们可以毫无问题地在 SonarQube Dashboard 上查看报告。但是每次通过 Jenkins 运行都会挂起,并且在一段时间后会因上述错误而失败。
【问题讨论】:
【参考方案1】:我也遇到了同样的问题。
我们有一个指向“.”的符号链接。设置作为构建的一部分,我认为这导致声纳找到无限数量的报告文件。
我在声纳之前删除了符号链接,一切都很好。
【讨论】:
嗨兰斯,好的,谢谢你的重点,我会检查一下。以上是关于Sonarqube - java.lang.OutOfMemoryError:超出 GC 开销限制的主要内容,如果未能解决你的问题,请参考以下文章
SonarQube 插件和 SonarQube 规则之间有啥关系?