Issue: SonarQube publishing task is timing out or taking way too long to report findings back to Azure DevOps pipeline
WARNING MESSAGE: ##[warning]Task ‘9d844899-6c86-4af2-ac96-b3f3fcc2b887’ takes too long to complete. Stopping after 1200s of polling. No quality gate will be displayed on build result
• **SonarQube Server Info & Specs:**
○ OS: Ubuntu 20.04.5
○ SonarQube Version: Developer Edition v10.6 (92116)
○ Memory: 64 Gig
○ Architecture: x86_64
○ CPU Model name: Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
○ JVM Memory Allocation:
§ sonar.web.javaOpts=-Xmx12288m -Xms4096m -XX:MaxDirectMemorySize=6144m -XX:+HeapDumpOnOutOfMemoryError
§ sonar.ce.javaOpts=-Xmx20480m -Xms10240m -XX:+HeapDumpOnOutOfMemoryError
§ sonar.search.javaOpts=-Xmx10240m -Xms10240m -XX:MaxDirectMemorySize=10240m -XX:+HeapDumpOnOutOfMemoryError
§ Breakdown:
1) sonar.web.javaOpts:
® Maximum Heap Size (-Xmx): 12 GB (12288m)
® Initial Heap Size (-Xms): 4 GB (4096m)
® Direct Memory Size (-XX:MaxDirectMemorySize): 6 GB (6144m)
® Heap Dump on OutOfMemoryError: Enabled
2) sonar.ce.javaOpts:
® Maximum Heap Size (-Xmx): 20 GB (20480m)
® Initial Heap Size (-Xms): 10 GB (10240m)
® Heap Dump on OutOfMemoryError: Enabled
3) sonar.search.javaOpts:
® Maximum Heap Size (-Xmx): 10 GB (10240m)
® Initial Heap Size (-Xms): 10 GB (10240m) - Fixed Heap Size
® Direct Memory Size (-XX:MaxDirectMemorySize): 10 GB (10240m)
® Heap Dump on OutOfMemoryError: Enabled
Log Analysis:
• The logs were pretty clean. No errors. They were more or less the same with nothing that stands out. Below is part of the ce.log for one of the scan that took about 21 minutes.
• es.log
• ce.log
• web.log
Programming Language: .Net Core 8
Log Sample:
2024.08.12 18:09:38 INFO ce[][o.s.c.t.CeWorkerImpl] Execute task | project=MyProjectName.RepoName_73937eb0-ef31-45cc-8097-465ef0ee3125 | type=REPORT | id=9d844899-6c86-4af2-ac96-b3f3fcc2b887 | submitter=Homer.Simpsons_63588
2024.08.12 18:09:45 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Extract report | status=SUCCESS | time=6990ms
2024.08.12 18:09:45 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist scanner context | status=SUCCESS | time=14ms
2024.08.12 18:09:45 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Propagate analysis warnings from scanner report | status=SUCCESS | time=20ms
2024.08.12 18:09:45 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Generate analysis UUID | status=SUCCESS | time=0ms
2024.08.12 18:09:45 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load analysis metadata | status=SUCCESS | time=8ms
2024.08.12 18:09:45 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Initialize | status=SUCCESS | time=15ms
2024.08.12 18:09:46 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Build tree of components | components=4820 | status=SUCCESS | time=153ms
2024.08.12 18:09:46 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Validate project | status=SUCCESS | time=6ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load quality profiles | status=SUCCESS | time=1943ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Checks executed before computation of measures | status=SUCCESS | time=7ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Generate SQ Upgrade analysis events | status=SUCCESS | time=5ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load file hashes and statuses | status=SUCCESS | time=235ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load Quality gate | status=SUCCESS | time=8ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load new code period | status=SUCCESS | time=22ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load prioritized rules | status=SUCCESS | time=11ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Detect file moves | reportFiles=4093 | dbFiles=4093 | addedFiles=0 | status=SUCCESS | time=116ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Detect file moves in Pull Request scope | status=SUCCESS | time=0ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load duplications | duplications=459 | status=SUCCESS | time=66ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute cross project duplications | status=SUCCESS | time=0ms
2024.08.12 18:09:48 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute size measures | status=SUCCESS | time=114ms
2024.08.12 18:10:05 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute new coverage | status=SUCCESS | time=16429ms
2024.08.12 18:10:05 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute coverage measures | status=SUCCESS | time=92ms
2024.08.12 18:10:05 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute comment measures | status=SUCCESS | time=8ms
2024.08.12 18:10:05 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute duplication measures | status=SUCCESS | time=8ms
2024.08.12 18:10:07 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute size measures on new code | status=SUCCESS | time=2026ms
2024.08.12 18:10:07 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute language distribution | status=SUCCESS | time=8ms
2024.08.12 18:10:07 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute test measures | status=SUCCESS | time=6ms
2024.08.12 18:10:07 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute complexity measures | status=SUCCESS | time=15ms
2024.08.12 18:10:07 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load measure computers | status=SUCCESS | time=0ms
2024.08.12 18:10:07 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute Quality Profile status | status=SUCCESS | time=7ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Execute component visitors | status=SUCCESS | time=56607ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Checks executed after computation of measures | status=SUCCESS | time=12ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute pull request fixed issues measure | status=SUCCESS | time=0ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute Quality Gate measures | status=SUCCESS | time=1ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute Quality profile measures | status=SUCCESS | time=2ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Generate Quality profile events | status=SUCCESS | time=6ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Generate Quality gate events | status=SUCCESS | time=6ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Generate Issue Detection events | status=SUCCESS | time=6ms
2024.08.12 18:11:03 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Check upgrade possibility for not analyzed code files. | status=SUCCESS | time=0ms
2024.08.12 18:11:04 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist scanner analysis cache | status=SUCCESS | time=139ms
2024.08.12 18:11:04 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist components | status=SUCCESS | time=115ms
2024.08.12 18:11:04 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist analysis | status=SUCCESS | time=8ms
2024.08.12 18:11:04 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist analysis properties | status=SUCCESS | time=17ms
2024.08.12 18:11:04 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist measures | inserts=57 | status=SUCCESS | time=64ms
2024.08.12 18:30:23 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist live measures | insertsOrUpdates=194423 | status=SUCCESS | time=1159120ms
2024.08.12 18:30:42 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist duplication data | insertsOrUpdates=101 | status=SUCCESS | time=18910ms
2024.08.12 18:30:42 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist new ad hoc Rules | status=SUCCESS | time=0ms
2024.08.12 18:30:42 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist issues | cacheSize=25.9 kB | inserts=0 | updates=34 | merged=0 | status=SUCCESS | time=69ms
2024.08.12 18:30:42 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Delete issue changes | changes=0 | status=SUCCESS | time=0ms
2024.08.12 18:30:42 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist project links | status=SUCCESS | time=3ms
2024.08.12 18:30:42 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist events | status=SUCCESS | time=9ms
2024.08.12 18:30:44 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist sources | status=SUCCESS | time=1794ms
2024.08.12 18:30:44 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist cross project duplications | status=SUCCESS | time=0ms
2024.08.12 18:30:44 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Enable analysis | status=SUCCESS | time=38ms
2024.08.12 18:30:44 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist Fixed issues in Pull Request | status=SUCCESS | time=0ms
2024.08.12 18:30:44 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Update last usage date of quality profiles | status=SUCCESS | time=24ms
2024.08.12 18:30:53 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Purge db | status=SUCCESS | time=9699ms
2024.08.12 18:30:53 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Load changed issues for indexing | status=SUCCESS | time=0ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Index analysis | status=SUCCESS | time=131ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Update need issue sync for branch | status=SUCCESS | time=8ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Compute total Project ncloc | status=SUCCESS | time=10ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Publishing taint vulnerabilities and security hotspots events | status=SUCCESS | time=5ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Send issue notifications | newIssuesNotifs=0 | newIssuesDeliveries=0 | myNewIssuesNotifs=0 | myNewIssuesDeliveries=0 | changesNotifs=0 | changesDeliveries=0 | status=SUCCESS | time=7ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Actions to execute when the computation is about to be finished | status=SUCCESS | time=0ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Publish task results | status=SUCCESS | time=0ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Trigger refresh of Portfolios and Applications | refreshesAPP=0 | status=SUCCESS | time=6ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=0 | projectWebhooks=0 | status=SUCCESS | time=6ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=0ms
2024.08.12 18:30:54 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Report branch Quality Gate status to devops platforms | status=SUCCESS | time=4ms
The below line stood out from the log:
2024.08.12 18:30:23 INFO ce[601e7a42-b44c-4c7b-9529-06f3702338c1][o.s.c.t.s.ComputationStepExecutor] Persist live measures | insertsOrUpdates=194423 | status=SUCCESS | time=1159120ms
What we have tried so far:
- sonar.qualitygate.wait=true
- sonar.qualitygate.timeout=1800
- Invetigation: Only one background task was running during the scan
- Read several articles from the community related to the topic