I have a set of Jenkins jobs that run in parallel using Ant
and upload JUnit and static analysis results to SonarQube.
I am seeing the error below frequently. I saw another question about this here. The solution was to serialize the execution of Sonar. However, that is not an option for me as that would significantly slow down my builds.
Any other solutions?
[sonar:sonar] 20:20:34.362 WARN - SQL Error: 50200, SQLState: HYT00
[sonar:sonar] 20:20:34.363 ERROR - Timeout trying to lock table "PROJECT_MEASURES"; SQL statement:
[sonar:sonar] select snapshot1_.created_at as col_0_0_, measuremod0_.metric_id as col_1_0_, measuremod0_.value as col_2_0_ from project_measures measuremod0_, snapshots snapshot1_ where measuremod0_.snapshot_id=snapshot1_.id and snapshot1_.project_id=? and snapshot1_.status=? and snapshot1_.qualifier<>? and (measuremod0_.characteristic_id is null) and (measuremod0_.person_id is null) and (measuremod0_.rule_id is null) and (measuremod0_.rule_priority is null) and (measuremod0_.metric_id in (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)) and snapshot1_.created_at>=? and snapshot1_.created_at<=? order by snapshot1_.created_at [50200-172]
[sonar:sonar] 20:20:34.390 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@6598c5f6[id=2736,key=com.ibm.cloud.cms.halos.acp.task.manager,qualifier=TRK], with key batch-com.ibm.cloud.cms.halos.acp.task.manager
Upgrade.
You don't specify which version of SonarQube you're on, but by 5.6, the scanner stopped talking directly to the database. So it no longer attempts to update any tables. Instead, it compiles an analysis report, which is then submitted to the server for final processing => no more timeouts trying to acquire locks.