Sonarscanner is slow

SonnarScanner never finishes the analysis before the 300s mark

  • SonarQube Enterprise Edition Version 9.9 (build 65466)
  • ‘dotnet-sonarscanner’ (version ‘6.2.0’)
  • running test coverage during PR on a github windows-latest runner
  • code is C#
    The end of analysis takes 5 minutes, 3 of those are "Waiting for the analysis report to be processed "
    And in the end it fails.
21:28:01.110 INFO: Waiting for the analysis report to be processed (max 300s)
21:28:01.251 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:28:06.457 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=188ms
21:28:11.604 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:28:16.747 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:28:21.987 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=234ms
21:28:27.131 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:28:32.276 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:28:37.404 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:28:42.549 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:28:47.802 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=250ms
21:28:52.938 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:28:58.095 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=156ms
21:29:03.210 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=110ms
21:29:08.340 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:29:13.470 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:29:18.630 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=157ms
21:29:23.781 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:29:28.926 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:29:34.104 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=172ms
21:29:39.238 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:29:44.368 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=126ms
21:29:49.501 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=128ms
21:29:54.627 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:29:59.771 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=140ms
21:30:04.931 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=157ms
21:30:10.076 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:30:15.221 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=140ms
21:30:20.524 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=298ms
21:30:25.652 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:30:30.784 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:30:36.067 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=281ms
21:30:41.433 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=360ms
21:30:46.574 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:30:51.819 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=234ms
21:30:56.948 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=125ms
21:31:02.090 DEBUG: GET 200 ***api/ce/task?id=AZCZZXIP1bxvHH-LMd7E | time=141ms
21:31:02.237 DEBUG: GET 200 ***api/qualitygates/project_status?analysisId=AZCZZXoPTdxh1IX2oHIM | time=147ms
21:31:02.264 INFO: ------------------------------------------------------------------------
21:31:02.264 INFO: EXECUTION FAILURE
21:31:02.264 INFO: ------------------------------------------------------------------------
21:31:02.264 INFO: Total time: 4:59.752s
21:31:02.624 ERROR: Error during SonarScanner execution
21:31:02.624 INFO: Final Memory: 75M/504M
21:31:02.624 INFO: ------------------------------------------------------------------------
QUALITY GATE STATUS: FAILED - View details on ***dashboard?id=<id>&pullRequest=5217
Process returned exit code 1
The SonarScanner did not complete successfully
21:31:02.725  Post-processing failed. Exit code: 1
Error: Process completed with exit code 1.

Also running tests takes 3.5 min without sonnarscanner and 5.5 with.
All the extra time makes a PR check reach 15 min which is too long.

Hey there.

You’ve probably set sonar.qualitygate.wait=true to synchronously wait for the Quality Gate’s result.

This can slow things down if the analysis takes a long time to process by SonarQube or if it’s waiting for a worker to be available. You can confirm which is the case by looking at your global Administration > Projects > Background Tasks or the projcet-specific Project Settings > Background Tasks

If you want to continue waiting for the Quality Gate status to decide whether or not to fail the build, the documentation on Compute Engine Performance should help you speed things up (like adding an additional worker, or enabling the parallel analysis of analyses of the same project).

I asked our administrator to make the changes, I will test as soon as they do.