"org.sonar.server.exceptions.BadRequestException: Rule not found" after upgrade from 5.6.7 LTS to 6.7.4 LTS

I am upgrading a 5.6 SonarQube installation to 6.7 LTS. The backend server is PostgreSQL.

The PostgreSQL database used to run 8.4 with ASCII encoding. It has been successfully converted to 9.6 with UTF-8 prior to the SonarQube upgrade.

The target system is sonarqube:6.7.4-alpine in Docker (https://hub.docker.com/_/sonarqube/) with docker-compose, based on the recipe here: https://github.com/SonarSource/docker-sonarqube/blob/master/recipes.md

Successful steps so far:

  • started the converted database running Postgres 9.6
  • started SonarQube 5.6 image with plugins (based on sonarqube:5.6-alpine), login successful, everything looks fine
  • started SonarQube 5.6.7 image with the same plugins (based on sonarqube:5.6.7-alpine)
  • ran SONAR-URL/setup to convert the database to 5.6.7, took about 10 minutes
  • still SonarQube 5.6.7, login successful, everything looks fine, restart works
  • started SonarQube 6.7.4 image with upgraded plugins (based on sonarqube:6.7.4-alpine)
  • ran SONAR-URL/setup to convert the database to 6.7.4, took about 3 hours

After the migration, SonarQube performed initialization: disabling of rules, indexing etc. The login UI was displayed but the last time I wasn’t able to login (using the LDAP plugin for authentication). This could be a temporary problem, I have managed to get this far before and was able to login directly after the migration.

However, always after migration to 6.7.4, the server fails to restart with “Rule not found”. Logs

[…]
2018.07.06 09:27:50 INFO web[][o.s.s.q.RegisterQualityProfiles] Update profile java/Sonar way
2018.07.06 09:27:50 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.sonar.server.exceptions.BadRequestException: Rule not found: squid:RedundantThrowsDeclarationCheck
[followed by stacktrace and server shutdown]

I have tried 3-4 times (which is quite arduous, since the upgrade takes so long). The failing rule is not always the same, but startup always fails in the same way.

Things I have tried between upgrade attempts:

  • upgrading plugins to the latest version, e.g. SonarC# 7.1 -> 7.2, SonarJava 5.4 -> 5.5
  • emptying the SonarQube data volume before restarting

Hi,

To be clear, are you installing the language analyzers in the 6.7 instance? Before the packaging changes made in 7.2, the bundled analyzers were only automatically installed on new instances. They won’t be automatically installed on your upgraded instance.

Ann

Yes, in the 6.7 image I have included all the language plugins that I used to have in 5.6, but 6.7 has the upgraded versions, according to the instructions at https://docs.sonarqube.org/display/SONAR/Upgrading.

I hope I understand your question correctly.

I finally managed to do a successful upgrade by removing projects from the database first (using the Web API). I removed projects which hadn’t been analyzed for a while, and projects which hadn’t been analyzed at all. Somehow the migration worked this time (although processing the measures still takes an inordinate amount of time).

I can only guess that either a) there were corrupt projects in the database which couldn’t be migrated properly, or b) the size of the database caused unhandled errors during the migration. Hopefully all goes well during the real migration next week. :slight_smile: