Problems viewing issues and performing pipeline scans plus excessive database usage

We are running an older version of SonarQube: LTS Enterprise 8.9.2. This environment was deployed several years ago by my predecessor (estimated 2020). It was deployed into an AWS environment using Terraform and leverages ECS Fargate for compute and an Aurora serverless DB PostgreSQL cluster for database. At the present time, there is only a single task and a single database instance. Recently, AWS forcibly upgraded our database from PostgreSQL 10.21 to 11.16. Following the upgrade, we’ve been experiencing issues with SonarQube. At first glance, all appeared to be normal. The UI loads normally and we are able to authenticate using SSO. The Projects still populate and most of the data that should exist in the database seems to appear normally; however, when viewing the Issues page (either globally or for an individual project), it spins for a bit and then turns to white and never loads. Additionally, developers who have integrated the tool into their CI/CD pipelines are no longer having their scans complete. When viewing the background tasks for a particular project, in almost every case the following errors are received:

### Error querying database.  Cause: org.postgresql.util.PSQLException: FATAL: terminating current active connection due to forced scale event
### The error may exist in org.sonar.db.component.ComponentMapper
### The error may involve org.sonar.db.component.ComponentMapper.selectUuidsByKeyFromProjectKey-Inline
### The error occurred while setting parameters
### SQL: SELECT      p.kee, p.uuid     FROM       components p     INNER JOIN       components root ON root.uuid=p.project_uuid AND root.kee=?
### Cause: org.postgresql.util.PSQLException: FATAL: terminating current active connection due to forced scale event

I disabled scaling on the RDS cluster to remediate this, but rather than fixing the problem, the task simply would run forever. Essentially, it would hang. Prior to the database upgrade, these tasks would take seconds to complete. They are now failing after 5-10 minutes due to the scaling error. Additionally, the database itself seems to be fluctuating drastically from a resource utilization perspective for no reason I am able to deduce.

Despite being older, our version of SonarQube is supported on our version of PostgreSQL, so I am perplexed as to what might be causing this. Any help would be greatly appreciated.

1 Like

Hey there.

This guide might help you.

1 Like

This is a super helpful response. Our environment is setup in a non-standard way so once I am able to get access to the database, I will attempt this and report back.

Thank you!

1 Like

Reporting back from the other side. This command took about 23 minutes to execute on our 14GB database. After completing, I can confirm that scans are now able to run successfully again. Thanks so much for your help with this.