Publish Quality Gate Result taking time of about 1hr and task automatically get cancelled

we are having sonarqube implementation and added following tasks

  1. Prepare analysis
  2. Run Code Analysis
  3. Publish Quality Gate Result

first two tasks runs perfectly but at the time of Publish Quality Gate Result its taking time of about 1hr and its just wait for below API

##[debug][SQ] Task status:PENDING

##[debug][SQ] Waiting for task ‘AYP5OfriePr39XnUI6nz’ to complete.

##[debug][SQ] API GET: ‘/api/ce/task’ with query “{“id”:“AYP5OfriePr39XnUI6nz”}”

##[debug]Response: 200 Body: “{“task”:{“id”:“AYP5OfriePr39XnUI6nz”,“type”:“REPORT”,“componentId”:“AYP5GYX2ePr39XnUI6nt”,“componentKey”:“SuzlonPredAnalytics”,“componentName”:“Suzlon- OASIS Platform Enhancement”,“componentQualifier”:“TRK”,“status”:“PENDING”,“submittedAt”:“2022-10-21T06:27:53+0000”,“submitterLogin”:“AzureDevops”,“branch”:“users/tghule/sonarqube”,“branchType”:“BRANCH”,“warnings”:}}”

can anyone help resolve the issue

Hey there.

How long is it taking the background task to process on the SonarQube side? (Project-level Administration/Project Settings > Background Tasks)

hello Colin,
as i ran pipeline with logs its taking around 60min and then the pipeline is cancelled automatically

“AYP5OfriePr39XnUI6nz” this is the task id which is failing again and again

please check the following logs before cancellation of the pipeline

##[debug][SQ] Task status:PENDING

##[debug]Re-evaluate condition on job cancellation for step: ‘Publish Quality Gate Result’.

##[error]The operation was canceled.

##[debug]System.OperationCanceledException: The operation was canceled

And, I woudl ask again, to check here:

How long is it taking the background task to process on the SonarQube side? (Project-level Administration/Project Settings > Background Tasks)

And see if it’s failing, or what is happening to the processing that it never moves past pending

it is showing successful but pipeline is failing because of cancellation of pipeline due to awaiting response. in the administration it took 1hr13min
attaching both the screenshots here below

1 hour and 13 minutes is a long time for any background task to process.

What version of SonarQube are you using? Does your SonarQube server / database have enough cpu/memory/disk to manage the load?

yeah its taking so long. and following are the details you asked for
SonarQube ID information
Server ID: 716787E2-AXSWc1HsswF2qoUkq2lx
DB configuration - Standard S1: 20 DTUs
App service plan - ASP-Sonarqube (B2: 1)

There’s a good chance your database is just very underpowered

The Standard S0, S1 and S2 tiers provide less than one vCore (CPU).

Regarding data storage, the Standard S0 and S1 service tiers are placed on Standard Page Blobs. Standard Page Blobs use hard disk drive (HDD)-based storage media and are best suited for development, testing, and other infrequently accessed workloads that are less sensitive to performance variability.

I would suggest scaling your database to see if the performance improves.

let me try it by scaling up the database configuration

Hi @all,

we’ve been experiencing the same issue lately.

Apparently, if in SonarQube the background tasks take too long, it indicates a DB problem because SonarQube relies on the DB performance.

Our Azure’s DB dashboard showed that the DB IOPS were > 90% last week.
Our Datadog metrics showed that last week processing_time & process_pending_time had an unusually high peak.

We are using Azure Postgresql DB General Purpose, 2 vCore(s), 50 GB. 68% of the storage was used. The IOPS scale with the provided storage size in a ratio of 3:1.

What did you change?
We scaled up the DB to 100GB, we now have 300IOPS instead of 150IOPS according to the Azure docs.

The problem still occurs in our pipelines, is this a bug?

As you can see after optimizing the DB the performance seems to have recovered however the publish time still takes way too long!


Sonarqube Background Tasks:

@Tusharghule Did you fix this issue?