声纳分析失败 - 无法请求/批量_bootstrap /属性

时间:2014-08-06 17:25:39

标签: maven jenkins sonarqube

我们几个月来一直在用SonarQube分析我们的项目,没有任何问题。从今天早上开始,分析失败了这个错误:

Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false

自从我们将Amazon EC2实例升级到Ubuntu 14.04和Oracle JDK8以来,这种情况正在发生。我们针对MySQL数据库Maven 3.1和Jenkins 1.571运行SonarQube 4.3.2。

以下是我们项目中运行Maven的日志:

[DEBUG] [13:12:25.839] Download: http://ec2-0.0.0.0.compute-1.amazonaws.com:9000/batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false (no proxy)
[DEBUG] [13:12:29.334] Updating semaphore batch-TalkManagement:TalkManagement-parent
[DEBUG] [13:12:39.372] Updating semaphore batch-TalkManagement:TalkManagement-parent
[DEBUG] [13:12:46.127] Release semaphore on project : org.sonar.api.resources.Project@2fa1044d[id=429,key=TalkManagement:TalkManagement-parent,qualifier=TRK], with key batch-TalkManagement:TalkManagement-parent
[DEBUG] [13:12:46.531] To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered
[ERROR] Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Talk Management System ............................ FAILURE [12:22.555s]
[INFO] TalkManagement .................................... SUCCESS [1:17.314s]
[INFO] TalkManagementServiceApi .......................... SUCCESS [13.759s]
[INFO] TalkManagementService ............................. SUCCESS [6:07.446s]
[INFO] TalkUIAutomationTest .............................. SUCCESS [7.225s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20:53.855s
[INFO] Finished at: Wed Aug 06 13:13:00 EDT 2014
[INFO] Final Memory: 39M/494M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.3.1:sonar (default-cli) on project TalkManagement-parent: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false: Read timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.3.1:sonar (default-cli) on project TalkManagement-parent: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
    at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
    at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:37)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:136)
    at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:194)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 30 more
Caused by: org.sonar.api.utils.SonarException: Unable to request: /batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:92)
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:82)
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:78)
    at org.sonar.batch.scan.ModuleSettings.downloadSettings(ModuleSettings.java:82)
    at org.sonar.batch.scan.ModuleSettings.addProjectProperties(ModuleSettings.java:77)
    at org.sonar.batch.scan.ModuleSettings.init(ModuleSettings.java:63)
    at org.sonar.batch.scan.ModuleSettings.<init>(ModuleSettings.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
    at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
    at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
    at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
    at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:677)
    at org.sonar.api.platform.ComponentContainer.getComponentByType(ComponentContainer.java:198)
    at org.sonar.batch.scan.ModuleScanContainer.addCoreComponents(ModuleScanContainer.java:86)
    at org.sonar.batch.scan.ModuleScanContainer.doBeforeStart(ModuleScanContainer.java:73)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175)
    at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:132)
    ... 33 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1888)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1883)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1882)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1455)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
[JENKINS] Archiving /home/ubuntu/.jenkins/workspace/TalkServiceCI/TalkUIAutomationTest/pom.xml to TalkManagement/TalkUIAutomationTest/1.1.8/TalkUIAutomationTest-1.1.8.pom
[JENKINS] Archiving /home/ubuntu/.jenkins/workspace/TalkServiceCI/TalkUIAutomationTest/target/TalkUIAutomationTest-1.1.8.jar to TalkManagement/TalkUIAutomationTest/1.1.8/TalkUIAutomationTest-1.1.8.jar
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:274)
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:235)
    at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:88)
    ... 88 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:701)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2929)
    at java.net.URLConnection.getContentEncoding(URLConnection.java:523)
    at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:272)
    ... 90 more

直接通过浏览器或卷曲访问http://ec2-0.0.0.0.compute-1.amazonaws.com:9000/batch_bootstrap/properties?project=TalkManagement:TalkManagementService&dryRun=false时,响应确实很慢但从不超过10秒。

修改实际上,在分析运行时获取此网址时,可能需要一分钟才能返回答案!

我们已尝试将以下属性添加到pom.xml文件中:

    <sonar.dryRun.readTimeout>60</sonar.dryRun.readTimeout>
    <sonar.preview.readTimeout>60</sonar.preview.readTimeout>

它看起来并没有帮助。

这是一个多模块项目,在最后一次失败之前,已在其他模块上成功调用/ batch_bootstrap / properties URL。

有什么想法吗?

谢谢!

修改

升级到Sonar 4.4,Maven Sonar插件2.4和Jenkins 1.574会得到相同的结果。

2 个答案:

答案 0 :(得分:1)

事实证明,EC2实例已经过载(CPU和内存都已浮动),并且Sonar无法在60秒内回答/ batch_bootstrap / properties URL,因此失败。我们迁移到更大的EC2实例,问题已经消失。

答案 1 :(得分:1)

或者只是试试这个,

select * from semaphores

这将列出卡住的构建,您将能够看到项目名称,kee。如果有任何行并且与您的项目相符,则记下该ID。然后从信号量表

中删除它
delete from semaphores where id  = $id

有时候,当jenkins杀死你的工作时,你会遇到这个问题。