I am using Sonar with Ant, importing Cobertura and unit test results and running code quality analysis with setting "Sonar + FindBugs". I have previously been able to analyse my (large) project with Sonar. I don't know, maybe I have done some changes but now the analysis does not finish anymore. Sonar has successfully imported Cobertura reports, then it tries to execute decorators but it just hangs (for hours):
p.PhasesTimeProfiler - Execute decorators...
I have tested this both on Windows7 and RHEL 6 machines. I have increased ANT java heap to 2048M. With smaller setting I usually at some point get a java heap exceeded -exception. The process is currently running, and the process is using 2266M of memory.
Any ideas? :)
The final lines before Sonar hangs are below (debug mode):
[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
With SQL set to verbose in Sonar Ant target, the final SQL statement where it hangs on is this:
[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=?
In the second run I also got this:
[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
When I have not increase the java heap size and execute Sonar Ant target through Jenkins, I get the following:
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)
The above java heap space problem does not occur if I increase Ant to use 2048M, but then the Decorator hangs, as in the first error output.