Long runtime of SonarCloudAnalyze, espcially to compress the zip file of the analysis

Template for a good new topic, formatted with Markdown:

  • ALM used:Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: C#, HTML, JSON
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

Using Task SonarCloudAnalyze@4 (4.0.2) the build server needs about 14 minutes to compress the zip file of the analysis. The task was canceled after more then 34 minutes runtime (complete build runtime 60 minutes). Building the solution in comparission oly takes 15m 29s - thus sonar analyze takes more then double of the build time.

11:54:20.835 INFO: SCM writing changed lines (done) | time=3157ms
11:54:29.365 INFO: Analysis report generated in 58826ms, dir size=88 MB
12:08:02.68 INFO: Analysis report compressed in 813299ms, zip size=33 MB
12:08:29.19 INFO: Analysis report uploaded in 26510ms

Log from Bowser window.zip (211.9 KB)

Hi,

Could you add -Dsonar.verbose=true to your analysis command line and give us the resulting analysis log?

Off-hand, I’m suspecting something going on with your file system. It’s definitely not normal (as I suspect you know :wink: ) for zip compression to double analysis duration.

 
Thx,
Ann

Hi @milbrandt,

The extended duration for report compression may be related to the Azure agent running your pipeline.

Could you provide more details about the Azure agent? Specifically, is it self-hosted or Microsoft-hosted? What kind of agent is it?

You can typically find this information in the Initialize job task at the start of your pipeline.

Hi @antoine.vinot
it is a self-hosted agent on Windows, Visual Studio 18

Starting: Initialize job
Agent name: 'XXX'
Agent machine name: 'XXX'
Current agent version: '4.268.0'
Agent running as: 'XXX'
Prepare build directory.
Set build variables.
Download all required tasks.
Checking job knob settings.
   Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES) 
   Knob: UseGitLongPaths = true Source: $(USE_GIT_LONG_PATHS) 
   Knob: UseNode24withHandlerData = True Source: $(DistributedTask.Agent.UseNode24withHandlerData) 
   Knob: EnableIssueSourceValidation = true Source: $(ENABLE_ISSUE_SOURCE_VALIDATION) 
   Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE) 
   Knob: DisableNode6Tasks = true Source: $(AGENT_DISABLE_NODE6_TASKS) 
   Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT) 
   Knob: ProcessHandlerSecureArguments = true Source: $(AZP_75787_ENABLE_NEW_LOGIC) 
   Knob: ProcessHandlerSecureArguments = false Source: $(AZP_75787_ENABLE_NEW_LOGIC_LOG) 
   Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT) 
   Knob: UseNewNodeHandlerTelemetry = True Source: $(DistributedTask.Agent.USENEWNODEHANDLERTELEMETRY) 
   Knob: ProcessHandlerEnableNewLogic = true Source: $(AZP_75787_ENABLE_NEW_PH_LOGIC) 
   Knob: EnableResourceMonitorDebugOutput = true Source: $(AZP_ENABLE_RESOURCE_MONITOR_DEBUG_OUTPUT) 
   Knob: EnableResourceUtilizationWarnings = true Source: $(AZP_ENABLE_RESOURCE_UTILIZATION_WARNINGS) 
   Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB) 
   Knob: FailJobWhenAgentDies = true Source: $(FAIL_JOB_WHEN_AGENT_DIES) 
   Knob: CheckForTaskDeprecation = true Source: $(AZP_AGENT_CHECK_FOR_TASK_DEPRECATION) 
   Knob: CheckIfTaskNodeRunnerIsDeprecated246 = True Source: $(DistributedTask.Agent.CheckIfTaskNodeRunnerIsDeprecated246) 
   Knob: UseNode20ToStartContainer = True Source: $(DistributedTask.Agent.UseNode20ToStartContainer) 
   Knob: EnableTimeoutLogFlushing = True Source: $(DistributedTask.Agent.EnableTimeoutLogFlushing) 
Agent.OS Windows_NT
Agent.OSArchitecture X64
Agent.OSVersion 10.0.26200
JAVA_HOME C:\Java\jdk-17.0.9+9	
PROCESSOR_ARCHITECTURE AMD64
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 85 Stepping 7, GenuineIntel
PROCESSOR_LEVEL 6
PROCESSOR_REVISION 5507

Hi @milbrandt

I’m struggling to match this info to your Azure VM setup. Can you tell me more about the VM? For instance, is it an older generation size?

It looks like the slow compression times might be caused by disk I/O bottlenecks. If possible, could you test this on a larger agent?

Hi @antoine.vinot
yes, some details I gave you already above on Feb 12th, but I will add further details.
Before I was asked the colleagues already run the build on several servers. They differ in runtime, but the main issue remains: long run time of SonarCloudAnalyze@4, especially the zipping from 88 MB to 33MB.

Run Agent Build SonarCloudAnalyze zipping
20260203.9 CLNDRCB9Z2 8m 9s 18m 59s 8m 25s
20260203.10 CLV1730002 15m 29s 24m37s (timeout) 13m 33s
20260206.5 CLV1730002 14m 12s 31m 47s 11m 21s
20260206.6 CLV1730002 14m 14s 29m 32s 12m 13s
20260223.2 windows-latest 17m 16s 12m 40s 20 s

On the server CLV1730002:

  • Only one drive C (HDD(SAS), 141 GB free, 395 GB total), NTFS
  • Intel(R) Xeon(R) Silver 4208 CPU @ 2.10GHz (2.10 GHz)
  • RAM dynamic allocated, as far as I know up to 32 GB
  • Windows 11 Enterprise 25H2 (26200.7781), 64 bit

Now I run the pipeline on a Microsoft hosted build agent and update dthe table in the message above. It really seems that the zipping depends on our hardware / network storage. We will talk to the IT department. Thanks for the investigation help.