A background task can be:
- The import of an analysis report.
- The computation of a portfolio.
- The import or export of a project.
An analysis is not complete until the relevant background task has been completed. Even though the SonarScanner's log shows
EXECUTION SUCCESS, the analysis results will not be visible in the SonarQube project until the background task has been completed. After a SonarScanner has finished analyzing your code, the result of the analysis (sources, issues, metrics) is sent to SonarQube server for final processing by the compute engine. Analysis reports are queued and processed serially.
At the project level, when there is a pending analysis report waiting to be consumed, you have a Pending notification in the header, next to the date of the most recent completed analysis.
Global administrators can view the current queue at Administration > Projects > Background Tasks. Project administrators can see the tasks for a project at Project Settings > Background Tasks.
Background tasks usually succeed, but sometimes unusual circumstances cause processing to fail. Examples include:
- Running out of memory while processing a report from a very large project
- Hitting a clash between the key of an existing module or project and one in the report
When that happens, the failed status is reflected on the project homepage, but that requires someone to notice it. You can also choose to be notified by email when background tasks fail, either on a project-by-project basis, or globally on all projects where you have administration rights, in the Notifications section of your profile.
For each analysis report, there is a dropdown menu allowing access to the scanner context, displaying the configuration of the scanner at the moment when the code scan has been run.
If processing failed for the task, the option Show Error Details will be displayed, allowing you to get the technical details of why the processing of the background task failed.
Administrators can cancel the processing of a pending task by clicking:
- On the red X available on each line of a Pending task
- On the red Bulk Cancel option next to the pending jobs count. This button cancels all pending tasks.
Once processing has begun on a report, it's too late to cancel it.