SonarQube Enterprise instance fails to start following 8.4 upgrade

Hi there,

I have just attempted upgrading our SonarQube Enterprise Edition test instance from 7.9.1 to the latest 8.4.0 release. Unfortunately it now wont start and the only error I can find in the log files is the following obscure message in web.log:

2020.07.06 15:00:36 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.base/java.util.TimSort.mergeLo(
        at java.base/java.util.TimSort.mergeAt(
        at java.base/java.util.TimSort.mergeCollapse(
        at java.base/java.util.TimSort.sort(
        at java.base/java.util.Arrays.sort(
        at java.base/java.util.ArrayList.sort(
        at org.sonar.server.issue.index.AsyncIssueIndexingImpl.sortProjectUuids(
        at org.sonar.server.issue.index.AsyncIssueIndexingImpl.triggerOnIndexCreation(
        at org.sonar.server.issue.index.IssueIndexer.triggerAsyncIndexOnStartup(
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(
        at java.base/$Head.forEach(
        at java.base/java.util.Optional.ifPresent(
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(
        at org.sonar.server.user.DoPrivileged.execute(
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(
        at org.sonar.server.platform.PlatformImpl.executeStartupTasks(
        at org.sonar.server.platform.PlatformImpl.access$400(
        at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$1(
        at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(
        at org.sonar.server.platform.PlatformImpl$1.doRun(
        at org.sonar.server.platform.PlatformImpl$
        at java.base/
2020.07.06 15:00:36 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2020.07.06 15:38:52 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped
2020.07.06 15:38:52 INFO  web[][o.s.s.e.CoreExtensionStopper] Stopping Governance
2020.07.06 15:38:52 INFO  web[][o.s.s.e.CoreExtensionStopper] Stopping Governance (done) | time=0ms
2020.07.06 15:38:52 WARN  web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:\n java.base@11.0.4/ Method)\n java.base@11.0.4/\n java.base@11.0.4/\n java.base@11.0.4/\n java.base@11.0.4/\n java.base@11.0.4/\n java.base@11.0.4/\n java.naming@11.0.4/\n java.base@11.0.4/

Are you please able to provide any guidance on how to investigate/resolve this issue?



Hi Sam, I’m investigating this. To be sure about your specific issue, could you please post here the result of this sql query please? You may have a lot of rows, so please upload the result as an attached file.

select component_uuid, created_at from snapshots

Hi Pierre, thanks for the prompt reply. I’ve attached the requested output from the query. Not sure if it’s relevant but we’re using SQL Server.sq_diag.txt (297.3 KB)

Thanks for your quick answer. I’m narrowing down the issue, it looks like this issue may come from projects or branches that does not have recent snapshot. Could you please run this query and tell us what you get? (this is counting projects+branches with not attached snapshot)

select count(pb.*) from project_branches pb
left join snapshots s on pb.uuid = s.component_uuid 
where s.component_uuid is null

Sorry for the delayed response - we’re on very different time zones (I’m in :australia:). On running that query I can see that there are 10 results. Out of interest I ran the same query on our production SonarQube instance (running 7.9.1) and there were 33 results. As that instance is accessible I decided to do some investigating and added the projects table to the query so I could see which projects were in the results. It then quickly became apparent that they fit one of two scenarios:

  • They were manually-created projects that had not yet been analysed at all
  • They were manually-created projects where the master branch had not yet been analysed

Hopefully this will provide useful!

Thanks for the details :slight_smile: I reproduced and prepared a fix. This bug is tracked down here. This fix will be applied to master today and is likely to be backported to an 8.4.1 version later this week.

That’s good news Pierre, thanks again for the rapid response!

Hi. Thanks for fixing this so quickly!

We are experiencing very similar issues. I have attempted to build from master but am still getting the same error as above. Do you know if the fix made it into master yet?

Hi, the change should be on master by tomorrow. We internally use another git repo that is sync with the public one every night. So you’ll have to wait for the sync :slight_smile:

Thanks! Built from master today and the issue has gone away. Will revert to the 8.4.1 docker image when released.

Hello Pierre. Any idea when 8.4.1 will be released?
Thanks in advance

Should happen this week :+1:

Thanks everyone for this new release. It’s working as excepted.

For people in the same (delicate) situation as I was : upgrading to, facing then upgrade to
I got strange behavior on my projects (total showing 40 projects but only 10 displayed), I had to stop SonarQube and clean data/es6 folder in order to recreate the ES indexes. After this operation, SonarQube seems to behave as before.

PS : of course, we should do all a DB backup before any upgrade :wink: