SonarQube analysis failed java.lang.OutOfMemoryError: Java heap space
SonarQube analysis failed java.lang.OutOfMemoryError: Java heap space
我正在使用 SonarQube 5.3 版并使用 Jenkins 1.651 版来启动 Sonar Scanner。我也在使用 Sonar Java 插件版本 3.11-build4121.
内存似乎有问题。从我的调试中,我发现一个可能的解决方案是通过在 Jenkins 中使用标志 -Xmx 来增加最大 Java 堆大小。所以我尝试了这个设置:
-Xss1024k -Xmx4096m -XX:MaxPermSize=256m
但是没有成功,因为它产生了以下错误。
2016.03.03 15:30:52 INFO [o.s.s.c.t.CeWorkerCallableImpl] Execute task | project=iipaxprod | id=AVM842148nwKD7ip-06E
2016.03.03 15:30:55 INFO [o.s.s.c.s.ExtractReportStep] Analysis report extracted | compressedSize=49 MB
2016.03.03 15:30:55 INFO [o.s.s.c.s.ComputationStepExecutor] Extract report | time=2485ms
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] SonarQube plugins:
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Java Properties 1.5 (javaProperties)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Findbugs 3.3 (findbugs)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Java 3.11-build4121 (java)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Git 1.1 (scmgit)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - PMD 2.5 (pmd)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Checkstyle 2.4 (checkstyle)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - SVN 1.2 (scmsvn)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] Settings for module: iipaxprod
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.core.id=20160302135558
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.core.startTime=2016-03-02T13:55:58+0100
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.core.version=5.3
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.host.url=http://192.168.40.179:9000/
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.java.source=1.6
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.login=admin
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.password=******
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.permission.template.default=default_template
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectBaseDir=/var/lib/jenkins/jobs/iipax-product-Project/workspace
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectKey=iipaxprod
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectName=iipax-Product
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectVersion=1.0
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.qualitygate=1
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.sourceEncoding=ISO-8859-1
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.sources=.
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.working.directory=/var/lib/jenkins/jobs/iipax-product-Project/workspace/.sonar
2016.03.03 15:30:55 INFO [o.s.s.c.s.ComputationStepExecutor] Log scanner context | time=5ms
2016.03.03 15:30:55 INFO [o.s.s.c.s.ComputationStepExecutor] Load analysis metadata | time=0ms
2016.03.03 15:30:58 INFO [o.s.s.c.s.ComputationStepExecutor] Build tree of components | time=2846ms
2016.03.03 15:30:59 INFO [o.s.s.c.s.ComputationStepExecutor] Validate project | time=79ms
2016.03.03 15:31:00 INFO [o.s.s.c.s.ComputationStepExecutor] Load debt model | time=1716ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load quality profiles | time=291ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load Quality gate | time=151ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load differential periods | time=35ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load inner file and in project duplications | time=311ms
2016.03.03 15:31:01 INFO [o.s.s.c.d.CrossProjectDuplicationStatusHolderImpl] Cross project duplication is disabled because it's disabled in the analysis report
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Compute cross project duplications | time=0ms
2016.03.03 15:31:02 INFO [o.s.s.c.s.ComputationStepExecutor] Compute size measures | time=431ms
2016.03.03 15:31:18 INFO [o.s.s.c.s.ComputationStepExecutor] Compute new coverage | time=16647ms
2016.03.03 15:31:18 INFO [o.s.s.c.s.ComputationStepExecutor] Compute coverage measures | time=47ms
2016.03.03 15:31:19 INFO [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=1000ms
2016.03.03 15:31:21 INFO [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=1997ms
2016.03.03 15:31:22 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=915ms
2016.03.03 15:31:25 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication data measures | time=2562ms
2016.03.03 15:31:26 INFO [o.s.s.c.s.ComputationStepExecutor] Compute language distribution | time=779ms
2016.03.03 15:31:26 INFO [o.s.s.c.s.ComputationStepExecutor] Compute test measures | time=49ms
2016.03.03 15:31:30 INFO [o.s.s.c.s.ComputationStepExecutor] Compute complexity measures | time=4833ms
2016.03.03 15:31:30 INFO [o.s.s.c.s.ComputationStepExecutor] Load measure computers | time=0ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] Execution time for each component visitor:
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - LoadComponentUuidsHavingOpenIssuesVisitor | time=5327ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - IntegrateIssuesVisitor | time=428288ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - CloseIssuesOnRemovedComponentsVisitor | time=0ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - SqaleMeasuresVisitor | time=3059ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - SqaleNewMeasuresVisitor | time=107507ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - LastCommitVisitor | time=112ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - MeasureComputersVisitor | time=834ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ComputationStepExecutor] Execute component visitors | time=546127ms
2016.03.03 15:46:28 ERROR [o.s.s.c.c.ComputeEngineContainerImpl] Cleanup of container failed
java.lang.OutOfMemoryError: Java heap space
2016.03.03 15:46:28 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVM842148nwKD7ip-06E
java.lang.OutOfMemoryError: Java heap space
2016.03.03 15:46:28 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=iipaxprod | id=AVM842148nwKD7ip-06E | time=935556ms
我注意到这个 post: 1 它遇到了类似的问题,但是一旦将堆内存大小设置为 4096,问题似乎就解决了,这对我来说不是。
关于如何解决这个问题有什么建议吗?
Edit-1:拼写正确。
整个项目大约有 760mb 大小和 100 万行代码。
我相信我找到了导致这个问题的原因 - 我一直在配置错误的参数。我在 Jenkins 的 Sonar Runner 中配置了参数,而问题出在 SonarQube Web 服务器上。一旦我将 SonarQube 服务器中 sonar.properties
文件中的参数 opt/sonar/conf
编辑为 sonar.web.javaOpts=-Xmx1280m
,SonarQube 服务器就可以分析 Sonar Runner 分析的结果。
我邀请您试用 SQ 5.4。
我们已经解决了 Compute Engine 的一堆堆消耗问题。
其中一个导致额外的堆消耗与项目中的行数成线性关系(参见 SONAR-7316)。这可能对你有帮助。
我正在使用 SonarQube 5.3 版并使用 Jenkins 1.651 版来启动 Sonar Scanner。我也在使用 Sonar Java 插件版本 3.11-build4121.
内存似乎有问题。从我的调试中,我发现一个可能的解决方案是通过在 Jenkins 中使用标志 -Xmx 来增加最大 Java 堆大小。所以我尝试了这个设置:
-Xss1024k -Xmx4096m -XX:MaxPermSize=256m
但是没有成功,因为它产生了以下错误。
2016.03.03 15:30:52 INFO [o.s.s.c.t.CeWorkerCallableImpl] Execute task | project=iipaxprod | id=AVM842148nwKD7ip-06E
2016.03.03 15:30:55 INFO [o.s.s.c.s.ExtractReportStep] Analysis report extracted | compressedSize=49 MB
2016.03.03 15:30:55 INFO [o.s.s.c.s.ComputationStepExecutor] Extract report | time=2485ms
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] SonarQube plugins:
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Java Properties 1.5 (javaProperties)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Findbugs 3.3 (findbugs)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Java 3.11-build4121 (java)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Git 1.1 (scmgit)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - PMD 2.5 (pmd)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - Checkstyle 2.4 (checkstyle)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - SVN 1.2 (scmsvn)
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] Settings for module: iipaxprod
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.core.id=20160302135558
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.core.startTime=2016-03-02T13:55:58+0100
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.core.version=5.3
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.host.url=http://192.168.40.179:9000/
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.java.source=1.6
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.login=admin
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.password=******
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.permission.template.default=default_template
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectBaseDir=/var/lib/jenkins/jobs/iipax-product-Project/workspace
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectKey=iipaxprod
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectName=iipax-Product
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.projectVersion=1.0
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.qualitygate=1
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.sourceEncoding=ISO-8859-1
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.sources=.
2016.03.03 15:30:55 INFO [o.s.s.c.s.LogScannerContextStep] - sonar.working.directory=/var/lib/jenkins/jobs/iipax-product-Project/workspace/.sonar
2016.03.03 15:30:55 INFO [o.s.s.c.s.ComputationStepExecutor] Log scanner context | time=5ms
2016.03.03 15:30:55 INFO [o.s.s.c.s.ComputationStepExecutor] Load analysis metadata | time=0ms
2016.03.03 15:30:58 INFO [o.s.s.c.s.ComputationStepExecutor] Build tree of components | time=2846ms
2016.03.03 15:30:59 INFO [o.s.s.c.s.ComputationStepExecutor] Validate project | time=79ms
2016.03.03 15:31:00 INFO [o.s.s.c.s.ComputationStepExecutor] Load debt model | time=1716ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load quality profiles | time=291ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load Quality gate | time=151ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load differential periods | time=35ms
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Load inner file and in project duplications | time=311ms
2016.03.03 15:31:01 INFO [o.s.s.c.d.CrossProjectDuplicationStatusHolderImpl] Cross project duplication is disabled because it's disabled in the analysis report
2016.03.03 15:31:01 INFO [o.s.s.c.s.ComputationStepExecutor] Compute cross project duplications | time=0ms
2016.03.03 15:31:02 INFO [o.s.s.c.s.ComputationStepExecutor] Compute size measures | time=431ms
2016.03.03 15:31:18 INFO [o.s.s.c.s.ComputationStepExecutor] Compute new coverage | time=16647ms
2016.03.03 15:31:18 INFO [o.s.s.c.s.ComputationStepExecutor] Compute coverage measures | time=47ms
2016.03.03 15:31:19 INFO [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=1000ms
2016.03.03 15:31:21 INFO [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=1997ms
2016.03.03 15:31:22 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=915ms
2016.03.03 15:31:25 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication data measures | time=2562ms
2016.03.03 15:31:26 INFO [o.s.s.c.s.ComputationStepExecutor] Compute language distribution | time=779ms
2016.03.03 15:31:26 INFO [o.s.s.c.s.ComputationStepExecutor] Compute test measures | time=49ms
2016.03.03 15:31:30 INFO [o.s.s.c.s.ComputationStepExecutor] Compute complexity measures | time=4833ms
2016.03.03 15:31:30 INFO [o.s.s.c.s.ComputationStepExecutor] Load measure computers | time=0ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] Execution time for each component visitor:
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - LoadComponentUuidsHavingOpenIssuesVisitor | time=5327ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - IntegrateIssuesVisitor | time=428288ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - CloseIssuesOnRemovedComponentsVisitor | time=0ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - SqaleMeasuresVisitor | time=3059ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - SqaleNewMeasuresVisitor | time=107507ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - LastCommitVisitor | time=112ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ExecuteVisitorsStep] - MeasureComputersVisitor | time=834ms
2016.03.03 15:40:37 INFO [o.s.s.c.s.ComputationStepExecutor] Execute component visitors | time=546127ms
2016.03.03 15:46:28 ERROR [o.s.s.c.c.ComputeEngineContainerImpl] Cleanup of container failed
java.lang.OutOfMemoryError: Java heap space
2016.03.03 15:46:28 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVM842148nwKD7ip-06E
java.lang.OutOfMemoryError: Java heap space
2016.03.03 15:46:28 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=iipaxprod | id=AVM842148nwKD7ip-06E | time=935556ms
我注意到这个 post: 1 它遇到了类似的问题,但是一旦将堆内存大小设置为 4096,问题似乎就解决了,这对我来说不是。
关于如何解决这个问题有什么建议吗?
Edit-1:拼写正确。
整个项目大约有 760mb 大小和 100 万行代码。
我相信我找到了导致这个问题的原因 - 我一直在配置错误的参数。我在 Jenkins 的 Sonar Runner 中配置了参数,而问题出在 SonarQube Web 服务器上。一旦我将 SonarQube 服务器中 sonar.properties
文件中的参数 opt/sonar/conf
编辑为 sonar.web.javaOpts=-Xmx1280m
,SonarQube 服务器就可以分析 Sonar Runner 分析的结果。
我邀请您试用 SQ 5.4。
我们已经解决了 Compute Engine 的一堆堆消耗问题。
其中一个导致额外的堆消耗与项目中的行数成线性关系(参见 SONAR-7316)。这可能对你有帮助。