SonarQube Bug 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,

Are you located in a different time zone than your SonarQube server? (Or does the server think it’s in a different time zone?)

 
Ann

Hi Ann,

Thanks for your response.
For your question, No, both TFS and SonarQube are in the same location but some how SonarQube doesn’t detect New Code for the next 5 hrs as shown in the above screenshot. This happens only for the new projects and stay there for the first 5 hrs period (Time difference between UTC and CST).

Hi,

Just to be thorough, have you checked your server timezone?

 
Ann

Ann,

Sonarqube server is in CST timezone. (TFS & Build Agent servers are also in the same timezone)
Also, We are using the default values in the sonar.properties file
#sonar.web.javaAdditionalOpts=
#sonar.ce.javaAdditionalOpts=
#sonar.search.javaAdditionalOpts=
Do we have any references in Database. If yes, then do we have a query to pull the data?

Hi,

I’m not asking about the physical location. I’m asking about the timezone setting. What timezone does the server think it’s in?

 
Ann

Ann,

Timezone settings in the server is also showing CST. Below is the screenshot

image

Hi,

Thanks for the verification. TBH, whether or not your server timezone matches your timezone, there’s something wrong here. I just wanted to get the “dumb” questions out of the way.

I’ve flagged this for more expert attention since I’m out of my depth at this point. Hopefully they’ll be along soon.

 
Ann

Ann,

Thanks for you time. I hope the experts team will get back on this and find a solution to this issue.

Hi Ann,

Do I need to provide any other details for this Issue, Or do we have anything that i need to do from my end to get it fixed? Can someone help on this issue.

Hi,

It’s just been noticed that you created duplicate threads and a different SonarSourcer has engaged with each one. So I’m going to close this thread and you can pursue the issue in your other thread

 
Ann