SonarQube New Code analysis is off by 5 hours

  • We are trying to achieve Quality gate to act on new code as soon as the second analysis is performed on the newly created project.
  • We are using SonarQube 8.9 LTS (8.9.0.43852)
  • Issue: When we have new project created, SonarQube is not showing the analysis on new code for next 5 hours (Time between Project Creation Time till +5 hrs)
  • Steps to reproduce:
  1. check in a baseline build of any code
  2. Build the code and get a Sonar Report
  3. Check in changes to TFS. These should be analyzed as new code
  4. View the timestamp on the change in Sonar (this is the bug, the timestamp doesn’t match TFS)
  5. The timestamp reflected in Sonar Matches the actual time of checkin.
  6. New code checked in after initial build is analyzed
  • We tried building the project multiple times by changing the code and the scanner didn’t show the changes on the new code. We see the updates on new code only after 5 Hours (UTC to CST time difference)
  • We had similar issue in 7.9 LTS version so we upgraded to 8.9 LTS assuming the issue could be fixed.
  • We also tried updating the Time zone in sonar.properties file to use UTC, America/Chicago and the default values for the below properties but didn’t help.

sonar.web.javaAdditionalOpts=-Duser.timezone=
sonar.search.javaAdditionalOpts=-Duser.timezone=
sonar.ce.javaAdditionalOpts=-Duser.timezone=






Hi @sai,

I’m sorry, I’m having trouble understanding the issue. Is the problem that the timestamp in SonarQube doesn’t match the one in TFS? Or is the issue that it takes 5 hours for you to see any results in the SonarQube UI?

Hi @Wouter_Admiraal,

Issue is that SonarQube is not showing Analysis on New coverage for 5 hours from the time of Initial analysis. Question was why is SonarQube not analyzing or showing analysis on new code.
Ideal scenario is when i run the 2nd build/analysis, it should show the code coverage on new code but its not happening the way it is supposed to.
I verified Server time zone, configurations and everything is the same (CST timezone).

I’m terribly sorry, but this still isn’t clear to me. So, if I try to recap:

  • You run an initial analysis at 1pm → quickly, SonarQube shows you the result, as expected.
  • You run a second analysis at 1:30pm → you see nothing in SonarQube.
  • At 6:30pm, all of a sudden, you see your second analysis in SonarQube. This is much later than you expect, plus the results aren’t what you expect.

Is this correct? I’m sorry if not, but I just don’t understand the problem from the screenshots you’ve posted.

About the 5h delay, if that’s the main issue here, I suggest looking into how/where you run your analysis. Do you always see this 5h delay, or did it happen a single time? Could it be your CI server’s queue? Did you check SonarQube’s own Background Tasks queue?

So here is what happens.

  • I run the analysis at 1pm → I can see the project created in the SonarQube with Baseline Analysis
  • I run another build at 1:20 PM with new code added → SonarQube doesn’t show the analysis on new code, but i can see the new code is added in the file and I can also see the overall number of lines of code count is increased.
  • When i run the 3rd build at 6:30 with new code added again, then i’m able to see the analysis results on the new code as shown in the screenshots above.

NOTE: I need to run the build at 6:30 inorder to see the analysis results on the newly added code. That being said, within this 5 hr period, i will not see any analysis on New Code doesn’t matter how many times you run the build by adding new lines of code.

We run the analysis from TFS and both TFS database, Agent server and Sonarqube are all in the same datacenter and has same timezone. And we don’t see anything from the Background Tasks. I hope you get this now.

Hi,

Did you get a change to look at my last message. Do you need any other clarification on this issue?

Wouter,
Is there a chance to take this as an issue or a bug instead of ‘Help’ and verify/ get help at the earliest

@Wouter_Admiraal @ganncamp Can we check this issue as we are having lot of impact on the analysis and see if this has to be considered as a bug? Your help and Effort is appreciated…