Sonarqube projects count are not showing accurate in Project dashboard

Must-share information (formatted with Markdown):

  • which versions are you using (9.9.1 LTS)
  • how is SonarQube deployed: zip

Hi,

I am unable to see the number of projects accurately in projects home page. Where as I have tried to remove the “$SONARQUBE-HOME/data/es7” , and restarted the server. Although I can see the project count is accurate, but after few days again we are facing same issue, the projects are not showing accurately.

Please let me know which action I need to do.

Thanks!

Hi,

It’s not clear to me what’s going on here.

Is it the total count of projects that’s wrong? Is it that some projects don’t show up? Both? Something else?

 
Ann

Hi @ganncamp

Total number of projects are showing less to me.

For few days I can see correct number of projects in Sonarqube after clearing the data inside $Sonarqube_home/data/es7. Later after few days automatically those number of projects are not matching.

Thanks!

Hi,

Thanks for the detail. Is there anything of note (any WARN or ERROR lines) in your server logs?

 
Thx,
Ann

Hi @ganncamp

There is no any “ERROR/WARN” in web.log files. But I can see below error in ce.log file.

Can you please check why our projects count is showing less. This issue is happening after a week, later after cleaning <Sonarqube_Home/data/es7>.

2023.11.05 16:15:12 WARN  ce[][c.z.h.pool.PoolBase] HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@62874a50 (This connection has been closed.). Possibly consider using a shorter maxLifetime value.
ERROR ce[AYuVK66wRd8omc2taC1m][o.s.c.t.CeWorkerImpl] Failed to finalize task with uuid 'AYuVK66wRd8omc2taC1m' and persist its state to dbjava.lang.IllegalStateException: Task does not exist anymore: CeTask{type=REPORT, uuid=AYuVK66wRd8omc2taC1m, component=Component{uuid='AYs4Y79oABJ996dhnqkY', key='CCT_awcp-mkn-build', name='CCT_awcp-mkn-build'}, mainComponent=Component{uuid='AYs4Y77_ABJ996dhnqkQ', key='CCT_awcp-mkn-build', name='CCT_awcp-application-build'}, submitter=User{uuid='AYm5_WrdSzrTuuEL5IJ_', login='sonar-service-account'}}
        at org.sonar.ce.queue.InternalCeQueueImpl.lambda$remove$0(InternalCeQueueImpl.java:115)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at org.sonar.ce.queue.InternalCeQueueImpl.remove(InternalCeQueueImpl.java:115)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.finalizeTask(CeWorkerImpl.java:245)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.afterExecute(CeWorkerImpl.java:239)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.close(CeWorkerImpl.java:199)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:161)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)

Hi,

That’s the piece of the puzzle we needed.

If I put these two things together:

It tells me that your DB connections are timing out. That’s why it works for a while and then stops. How is SonarQube authenticating to your DB? With login/password? If so, the settings listed in SONAR-17762 may help.

 
Ann

Hi @ganncamp

I think which I pasted error in previous comment is something different one, its not related to this issue. I think there was issue with elastic search.

Can you please check this what needs to be done at elastic search. Since after cleaning up the data inside <Sonarqube_home>/data/es7, projects are reflecting in correct.

Hi,

I’m confused at this point. Your initial problem seems to be solved, and you say your DB connection is fine. So… you’re all good?

 
Ann

Hi @ganncamp
Still my problem is not resolved. I mean project count is not showing accurately. After deleting <Sonar_home>/data/es7 folder, i can able to see the accurate project count.
Please let us know what we can do to resolve this shouldn’t happen again frequently.

Hi,

I guess I don’t understand what the problem is.

Are you saying that after clearing the ES indices, project count returns to normal for a while, and then gets corrupted again?

If so, are there any errors in your server logs?

 
Ann