问题
While using the sonar runner to analyze the multi module project I frequently get the “Read Timed Out” error. I have Jenkins configured with SonarQube 5.1.1. Our project is kind of web project, we have a couple of sonar plugins for the analysis like web, css, java, findbugs, js, xml and jacoco. If I load the given link "http://172.21.145.84:9000/batch/project?key=webportal&preview=false" from browser it works, but sometimes it takes quite long to load the response data. Can anyone please give me any suggestion regarding this failure? I have shared the sonar log below.
SonarQube Runner 2.4
Java 1.7.0_45 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
INFO: Runner configuration file: C:\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: D:\Jenkins\jobs\Webportal_2.0_Drop1Branch\workspace\DataModel\..\ucfed_webportal_plugin_att\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: D:\Jenkins\jobs\Webportal_2.0_Drop1Branch\workspace\DataModel\..\ucfed_webportal_plugin_att\.sonar
INFO: SonarQube Server 5.1.1
17:11:29.762 INFO - Load global repositories
17:11:30.027 INFO - Load global repositories (done) | time=281ms
17:11:30.042 INFO - Server id: 20150707155744
17:11:30.042 INFO - User cache: C:\Users\Administrator\.sonar\cache
17:11:30.042 INFO - Install plugins
17:11:30.479 INFO - Install JDBC driver
17:11:30.495 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
17:11:32.538 INFO - Initializing Hibernate
17:11:35.409 INFO - Load project repositories
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 26.832s
Final Memory: 46M/303M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to request: /batch/project?key=webportal &preview=false
ERROR: Caused by: Read timed out
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Extended Email Publisher is currently disabled in project settings
Finished: FAILURE
回答1:
Turns out I ran in to the same problem due to a large SQL query result set. Incleasing sonar.jdbc.maxWait to 300000 did the trick. Great help! thanks a bunch !
回答2:
As you can see the error is related with the read timeout, this is produced by the fact that the project it has to read is quite big. In my case I modified the sonar.jdbc.maxWait value of the configuration file: /sonarqube-5.1.2/conf/sonar.properties
# The maximum number of milliseconds that the pool will wait (when there
# are no available connections) for a connection to be returned before
# throwing an exception, or <= 0 to wait indefinitely.
sonar.jdbc.maxWait=10000
When I perform this change, the error disappear. Good luck
回答3:
In the long run of using SonarQube, I was able to tackle the above issue with few tweaks by keeping the below mentioned points in mind.
- Increase in hardware performance.
- Keep the system to run only SonarQube.
- Restart the sonar server once in a week.
Will give a good result.
回答4:
You are facing the following limitation that we'll try to address in SonarQube 5.2: SONAR-6604
(I've added a reference to your post in the description of the ticket)
Note that you are using the default installation which is based on the embedded H2 database, so you can't expect to have good performances. I guess you must have noticed the big red warning at the bottom of the page.
来源:https://stackoverflow.com/questions/31423318/sonarqube-5-1-1-read-timed-out-error-occurs-while-loading-project-repositories