3

在使用声纳运行器分析多模块项目时,我经常收到“读取超时”错误。我为 Jenkins 配置了 SonarQube 5.1.1。我们的项目是一种网络项目,我们有几个声纳插件用于分析,如 web、css、java、findbugs、js、xml 和 jacoco。如果我从浏览器加载给定的链接“ http://172.21.145.84:9000/batch/project?key=webportal&preview=false ”它可以工作,但有时加载响应数据需要很长时间。任何人都可以就这次失败给我任何建议吗?我在下面分享了声纳日志。

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
4

5 回答 5

2

事实证明,由于 SQL 查询结果集较大,我遇到了同样的问题。将 sonar.jdbc.maxWait增加到300000就可以了。很大的帮助!非常感谢!

于 2016-01-19T17:43:03.287 回答
1

如您所见,该错误与读取超时有关,这是由于它必须读取的项目很大。就我而言,我修改了配置文件的sonar.jdbc.maxWait值:/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

当我执行此更改时,错误消失了。祝你好运

于 2015-10-27T11:53:24.153 回答
1

在长期使用 SonarQube 的过程中,通过牢记以下几点,我能够通过一些调整来解决上述问题。

  • 硬件性能提升。
  • 保持系统仅运行 SonarQube。
  • 每周重新启动一次声纳服务器。

会带来好的结果。

于 2016-02-08T18:22:56.220 回答
0

您面临以下限制,我们将在 SonarQube 5.2 中尝试解决:SONAR-6604

(我在票的描述中添加了对您帖子的引用)

请注意,您使用的是基于嵌入式 H2 数据库的默认安装,因此您不能期望有良好的性能。我想你一定注意到了页面底部的大红色警告。

于 2015-07-23T14:43:11.237 回答
0

我在 Sonar 8.9.1 中遇到了类似的问题:

请求url失败:http://.../batch/project.protobuf?key=...: timeout: Read timed out

就我而言,问题是一个非常大的 Jacoco xml 覆盖文件。我通过增加sonar.ws.timeout参数的默认值(60 秒)来解决它,如文档中所述。

于 2021-11-15T17:41:19.060 回答