我正在使用带有Ant的Sonar,导入Cobertura和单元测试结果,并通过设置“Sonar + FindBugs”运行代码质量分析。我以前能用Sonar分析我的(大)项目。我不知道,也许我已经做了一些改变,但现在分析还没有完成。 Sonar已成功导入Cobertura报告,然后它尝试执行装饰器,但它只是挂起(几个小时):
p.PhasesTimeProfiler - 执行装饰器......
我在Windows7和RHEL 6机器上都测试了这个。我已将ANT java堆增加到2048M。对于较小的设置,我通常在某些时候得到一个java堆超出-exception。该进程当前正在运行,并且该进程正在使用2266M的内存。
有什么想法吗? :)
Sonar挂起之前的最后一行是(调试模式):
[sonar:sonar] 10:25:24.348 DEBUG raphMetricAggregator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.350 DEBUG emDashBoardDecorator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.505 DEBUG raphMetricAggregator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.505 DEBUG emDashBoardDecorator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.986 DEBUG raphMetricAggregator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.986 DEBUG emDashBoardDecorator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.994 DEBUG raphMetricAggregator - Checking for resource type: CLA
[sonar:sonar] 10:25:24.995 DEBUG emDashBoardDecorator - Checking for resource type: CLA
[sonar:sonar] 10:25:25.206 DEBUG raphMetricAggregator - Checking for resource type: CLA
[sonar:sonar] 10:25:25.206 DEBUG emDashBoardDecorator - Checking for resource type: CLA
[sonar:sonar] 10:25:25.214 DEBUG raphMetricAggregator - Checking for resource type: CLA
[sonar:sonar] 10:25:25.214 DEBUG emDashBoardDecorator - Checking for resource type: CLA
在Sonar Ant目标中将SQL设置为verbose,它挂起的最终SQL语句是:
[sonar:sonar] 10:00:31.855 DEBUG org.hibernate.SQL - select snapshot0_.id as
id7_, snapshot0_.build_date as build2_7_, snapshot0_.created_at as created3_7_,
snapshot0_.depth as depth7_, snapshot0_.islast as islast7_, snapshot0_.parent_sn
apshot_id as parent6_7_, snapshot0_.path as path7_, snapshot0_.period1_date as p
eriod8_7_, snapshot0_.period1_mode as period9_7_, snapshot0_.period1_param as pe
riod10_7_, snapshot0_.period2_date as period11_7_, snapshot0_.period2_mode as pe
riod12_7_, snapshot0_.period2_param as period13_7_, snapshot0_.period3_date as p
eriod14_7_, snapshot0_.period3_mode as period15_7_, snapshot0_.period3_param as
period16_7_, snapshot0_.period4_date as period17_7_, snapshot0_.period4_mode as
period18_7_, snapshot0_.period4_param as period19_7_, snapshot0_.period5_date as
period20_7_, snapshot0_.period5_mode as period21_7_, snapshot0_.period5_param a
s period22_7_, snapshot0_.purge_status as purge23_7_, snapshot0_.qualifier as qu
alifier7_, snapshot0_.project_id as project25_7_, snapshot0_.root_snapshot_id as
root26_7_, snapshot0_.root_project_id as root27_7_, snapshot0_.scope as scope7_
, snapshot0_.status as status7_, snapshot0_.version as version7_ from snapshots
snapshot0_ where snapshot0_.islast=? and snapshot0_.project_id=(select resourcem
o1_.id from projects resourcemo1_ where resourcemo1_.kee=?)
[sonar:sonar] 10:00:31.899 DEBUG org.hibernate.SQL - select snapshotso0_.id a
s id13_, snapshotso0_.data as data13_, snapshotso0_.snapshot_id as snapshot3_13_
from snapshot_sources snapshotso0_ where snapshotso0_.snapshot_id=?
在第二轮比赛中我也得到了这个:
[sonar:sonar] 11:16:40.149 DEBUG b.b.JdbcDriverHolder - To prevent a memory leak
, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
当我没有增加java堆大小并通过Jenkins执行Sonar Ant目标时,我得到以下内容:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2746)
at java.util.ArrayList.ensureCapacity(ArrayList.java:187)
at java.util.ArrayList.add(ArrayList.java:378)
at org.sonar.plugins.core.timemachine.ViolationTrackingDecorator.mapViolations(ViolationTrackingDecorator.java:131)
at org.sonar.plugins.core.timemachine.ViolationTrackingDecorator.decorate(ViolationTrackingDecorator.java:70)
at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:79)
at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:70)
at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:63)
at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:63)
如果我将Ant增加到使用2048M,就不会出现上述java堆空间问题,但是装饰器会挂起,就像在第一个错误输出中一样。
答案 0 :(得分:1)
我很遗憾地报告说,如果不从MySQL数据库中删除整个项目,我就无法解决这个问题。我注意到它在开始挂起后做了两处改动。 1)我似乎已将项目密钥更改为其他内容,2)我已将质量配置文件从默认更改为" Sonar + findbugs"。
Sonar在4次运行(即4天)后停止工作,因此我将从现在开始查看这是否有效而不更改我的初始设置。今天早上的第一场比赛没问题。