1

I have sonarqube 5.1 installed and running across a number of microservices and package modules, but one in particular is causing me no end of grief. It's a modestly large maven project with about 3,300 java files (and ok, we have some code debt — who knew?), but the error message is completely opaque. I'm connecting to an AWS RDS postgres db (9.3.5), and typically invoke maven through our build server, TeamCity (9.0.3).

The error in the build logs are...

[07:24:07][net.ulfhedinn:Parent] [INFO] [15:19:55.114] Store results in database
[07:24:15][net.ulfhedinn:Parent] [INFO] [15:20:02.695] Analysis reports generated in 651ms, dir size=1 MB
[07:24:17][net.ulfhedinn:Parent] [INFO] [15:20:04.645] Analysis reports compressed in 1949ms, zip size=1 MB
[07:24:17][net.ulfhedinn:Parent] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project Parent: java.io.IOException: Error writing to server

The error (in postgres) is...

2015-11-12 15:24:18 UTC:10.31.61.166(37212):sonar@sonar:[7800]:LOG: unexpected EOF on client connection with an open transaction

There are no errors in sonar server, just a bunch of 200's.

When running maven in debug mode, the full stack trace becomes:

[17:24:58]W:     [Step 2/2] [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project Parent: java.io.IOException: Error writing to server -> [Help 1]
[17:24:58] :     [Step 2/2] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project Parent: java.io.IOException: Error writing to server
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
[17:24:58] :     [Step 2/2]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
[17:24:58] :     [Step 2/2]     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
[17:24:58] :     [Step 2/2]     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
[17:24:58] :     [Step 2/2]     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
[17:24:58] :     [Step 2/2]     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
[17:24:58] :     [Step 2/2]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[17:24:58] :     [Step 2/2]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[17:24:58] :     [Step 2/2]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[17:24:58] :     [Step 2/2]     at java.lang.reflect.Method.invoke(Method.java:483)
[17:24:58] :     [Step 2/2]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
[17:24:58] :     [Step 2/2]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
[17:24:58] :     [Step 2/2]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
[17:24:58] :     [Step 2/2]     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[17:24:58] :     [Step 2/2] Caused by: org.apache.maven.plugin.MojoExecutionException: java.io.IOException: Error writing to server
[17:24:58] :     [Step 2/2]     at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
[17:24:58] :     [Step 2/2]     at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:104)
[17:24:58] :     [Step 2/2]     at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:135)
[17:24:58] :     [Step 2/2]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
[17:24:58] :     [Step 2/2]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
[17:24:58] :     [Step 2/2]     ... 19 more
[17:24:58] :     [Step 2/2] Caused by: com.github.kevinsawicki.http.HttpRequest$HttpRequestException: java.io.IOException: Error writing to server
[17:24:58] :     [Step 2/2]     at com.github.kevinsawicki.http.HttpRequest.code(HttpRequest.java:1483)
[17:24:58] :     [Step 2/2]     at com.github.kevinsawicki.http.HttpRequest.ok(HttpRequest.java:1508)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.report.PublishReportJob.uploadMultiPartReport(PublishReportJob.java:122)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.report.PublishReportJob.execute(PublishReportJob.java:77)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.phases.DatabaseModePhaseExecutor.publishReportJob(DatabaseModePhaseExecutor.java:188)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:134)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264)
[17:24:58] :     [Step 2/2]     at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
[17:24:58] :     [Step 2/2]     at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220)
[17:24:58] :     [Step 2/2]     at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
[17:24:58] :     [Step 2/2]     at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
[17:24:58] :     [Step 2/2]     at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
[17:24:58] :     [Step 2/2]     at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
[17:24:58] :     [Step 2/2]     at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
[17:24:58] :     [Step 2/2]     at org.sonar.runner.batch.BatchIsolatedLauncher.executeOldVersion(BatchIsolatedLauncher.java:92)
[17:24:58] :     [Step 2/2]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[17:24:58] :     [Step 2/2]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[17:24:58] :     [Step 2/2]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[17:24:58] :     [Step 2/2]     at java.lang.reflect.Method.invoke(Method.java:483)
[17:24:58] :     [Step 2/2]     at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
[17:24:58] :     [Step 2/2]     at com.sun.proxy.$Proxy42.executeOldVersion(Unknown Source)
[17:24:58] :     [Step 2/2]     at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:284)
[17:24:58] :     [Step 2/2]     at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:166)
[17:24:58] :     [Step 2/2]     at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:153)
[17:24:58] :     [Step 2/2]     at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:99)
[17:24:58] :     [Step 2/2]     ... 22 more
[17:24:58] :     [Step 2/2] Caused by: java.io.IOException: Error writing to server
[17:24:58] :     [Step 2/2]     at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:664)
[17:24:58] :     [Step 2/2]     at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:676)
[17:24:58] :     [Step 2/2]     at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1532)
[17:24:58] :     [Step 2/2]     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
[17:24:58] :     [Step 2/2]     at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
[17:24:58] :     [Step 2/2]     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
[17:24:58] :     [Step 2/2]     at com.github.kevinsawicki.http.HttpRequest.code(HttpRequest.java:1481)
[17:24:58] :     [Step 2/2]     ... 54 more
[17:24:58]W:     [Step 2/2] [ERROR] 
[17:24:58]W:     [Step 2/2] [ERROR] 
[17:24:58]W:     [Step 2/2] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[17:24:58]W:     [Step 2/2] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[17:24:58]W:     [Step 2/2] Process exited with code 1
Jón Tómas
  • 61
  • 1
  • 4
  • That 5.2 version is unstable; see a somewhat [related post](http://stackoverflow.com/questions/33287641/sonar-maven-plugin-build-error-sonarqube-version-null/33354118#33354118). Try downgrading. – Kenney Nov 12 '15 at 18:59
  • whoops, looks like we're on 5.1 - updating the issue – Jón Tómas Nov 12 '15 at 23:52
  • What URL is attempted to be contacted? Any idea? – Kenney Nov 13 '15 at 00:14
  • Running this through our debugger, the IOException appears to be happening during "POST https://sonar.ulfhedinn.net/api/computation/submit_report?projectKey=net.ulfhedinn:Parent: – Jón Tómas Nov 17 '15 at 02:19
  • @Kenney any advice? It fails pretty quickly, once it starts trying to upload... Is there a parameter I can tweak to increase file limits on upload, perhaps? – Jón Tómas Nov 18 '15 at 16:56
  • That host isn't reachable from my machine either, and I wonder if it's necessary to upload the report there? You can grep/search for the url in the code or poms and disable it. The host being unreachable seems to be the only problem. – Kenney Nov 18 '15 at 18:02
  • It's unreachable because it sits behind our company VPN — I see no reason to expose an internal tool to the web ;-). The machine is definitely reachable from where this analysis is running. Are you *sure* there isn't a setting I can change to increase the permitted filesize upload or something? – Jón Tómas Nov 18 '15 at 23:10
  • If you don't want to expose it, better configure your DNS to only resolve `sonar.yourdomain` from within the VPN, and also, don't use a public IP ;-). The problem is that sonar can't upload the report because of a write error, which usually means the remote has disconnected. AFAICT it appears the problem is in `/submit_report`, not on the client side. So, maybe there is a setting, but I don't know what proprietary software may be running behind your company firewall. You could monitor the server log and possibly the network traffic to see what's going wrong exactly. – Kenney Nov 18 '15 at 23:22

0 Answers0