Sonar requires us to restart the server 2x a day to have successful scans

We are running SonarQube Community Edition Version 7.9.6 (build 41879), and Gradle SonarQube plugin 3.0 to build and scan our java projects.

Our Sonarqube server is shut down nightly to save money in cloud hosting, but after it is started in the morning all builds using the Gradle plugin fail until we restart the SQ server a second time. Then it is “happy” for the rest of the day.

We are running automated builds on Jenkins 2.263.4

We do have a relaxed policy on minimum coverage for passing code compared with the stock quality profiles (i.e. only 20% minimum coverage).

When we run the job with Gradle stacktrace turned on, we have:

java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.ActiveRules
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)
    at .....
java.lang.NullPointerException
    at org.sonar.scanner.rule.DefaultActiveRulesLoader.readPage(DefaultActiveRulesLoader.java:102)
   at ...

Hi,

Welcome to the community!

What, if anything, shows up in your server logs? And could we have a larger snippet of your analysis log?

 
Ann

Nothing. The last message in our server logs is “SonarQube started successfully”. The only log that seems to be updated is the access logs. The sonar.log, es.log, and ce.log files don’t have any information past the initial startup. It’s making troubleshooting impossible.

Hi,

Is Docker somehow involved here? And could this have anything to do with DNS?

 
Ann

Docker is not involved, and I can’t answer the question about DNS. How does DNS cause Sonar to fail? My team is troubleshooting blind due to the lack of application logging once the service is up and running.

Have you tried tuning up the logging level?

DNS was a shot in the dark based on the fact that Gradle doesn’t seem to be able to find the server.

And in fact, the error you’ve provided isn’t quite the one I would have expected. Can you provide the full, failing analysis log?

 
Ann

My DevOps guy gave it to me in an image–at least what we got from Gradle. I couldn’t find a way to upload an image to the forum or I would have provided it. Keep in mind that Gradle does work after we restart Sonar a second time. And then it works all day until we shut down automatically for the night.

Where do we set the logging level for Sonar itself?

Hi,

Ideally I’d like to see the analysis logs starting from (with) the analysis command.

You can set the logging level in the SonarQube UI: Administration → System → Logs level

 
Ann

Regarding the log granularity, they are set at “INFO” at the moment, what level do you recommend to find something useful when things fail?

This problem only seems to plague us in the AM, and is currently working now. I’m trying to find a failed build in history that also has the stack trace in it, but it is taking time.

I have the robust logging on the client side, but we need the magic parameters in gradle to include the stacktrace.