SonarScanner MSBuild: Socket Error while uploading report to server

scanner
sonarqube

(sonaruser) #1

Facing a socket error while the report is being uploaded to Sonarqube Server.

Can’t read file part for parameter report.

Processing of multipart/form-data request failed. Unexpected EOF read on the socket

Here is my environment:

  • SonarScanner.MSBuild.exe - 4.3.1.1372
  • MSBuild - 14.0
  • SonarQube Server - 6.7.5 (build 38563) with HTTP port
  • Java - 1.8.0_171

Disabling anti-virus scan didn’t help.

Stack trace below from the server:

`2018.08.27 05:35:46 WARN  web[AWVXE187nt9Be4C0AACa][o.s.s.w.ServletRequest] Can't read file part for parameter report
java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket
    at org.apache.catalina.connector.Request.parseParts(Request.java:2911)
    at org.apache.catalina.connector.Request.parseParameters(Request.java:3211)
    at org.apache.catalina.connector.Request.getParameter(Request.java:1137)
    at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:381)
    at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:153)
    at org.sonar.server.ws.ServletRequest.readParam(ServletRequest.java:76)
    at org.sonar.api.server.ws.internal.ValidatingRequest.readParamOrDefaultValue(ValidatingRequest.java:132)
    at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:95)
    at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:70)
    at org.sonar.api.server.ws.Request.getParam(Request.java:297)
    at org.sonar.server.ce.ws.SubmitAction.handle(SubmitAction.java:104)
    at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:103)
    at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:86)
    at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:126)
    at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:95)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:87)
    at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:72)
    at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.sonar.server.platform.web.RedirectFilter.doFilter(RedirectFilter.java:61)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.sonar.server.platform.web.requestid.RequestIdFilter.doFilter(RequestIdFilter.java:63)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Unexpected EOF read on the socket
    at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:297)
    at org.apache.catalina.connector.Request.parseParts(Request.java:2864)
    ... 52 common frames omitted
Caused by: java.io.EOFException: Unexpected EOF read on the socket
    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:722)
    at org.apache.coyote.http11.Http11InputBuffer.access$300(Http11InputBuffer.java:40)
    at org.apache.coyote.http11.Http11InputBuffer$SocketInputBuffer.doRead(Http11InputBuffer.java:1072)
    at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:140)
    at org.apache.coyote.http11.Http11InputBuffer.doRead(Http11InputBuffer.java:261)
    at org.apache.coyote.Request.doRead(Request.java:581)
    at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:326)
    at org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:642)
    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:349)
    at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:183)
    at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:977)
    at org.apache.tomcat.util.http.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:881)
    at java.io.InputStream.read(Unknown Source)
    at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:98)
    at org.apache.tomcat.util.http.fileupload.util.Streams.copy(Streams.java:68)
    at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:293)
    ... 53 common frames omitted`

(Julien Henry) #2

Hi,

Are you using a corporate proxy between the scanner and the SonarQube server?

Do you have any interesting log on scanner side?


(sonaruser) #3

Hi Julien,
Yes, we do have a proxy between the scanner and server.

Note that I also use the same machine for running scans using MSBuild.SonarQube.Runner.exe (version 1.1.0.0) that uploads the report to a different SonarQube server (v5.2). There are no issues connecting to this server.

Below is all I see on the scanner log:

`03:28:36.868 DEBUG: Upload report
 03:28:48.088 INFO: ------------------------------------------------------------------------
 03:28:48.088 INFO: EXECUTION FAILURE
 03:28:48.089 INFO: ------------------------------------------------------------------------
 03:28:48.089 INFO: Total time: 11:44.917s
 03:28:48.145 INFO: Final Memory: 6M/126M
 03:28:48.145 INFO: ------------------------------------------------------------------------
 03:28:48.145 ERROR: Error during SonarQube Scanner execution
 03:28:48.145 ERROR: Fail to request http://xxxxxxxxx:9000/api/ce/submit? 
 projectKey=xxx&projectName=xxxxx
 03:28:48.145 ERROR: Caused by: timeout
 03:28:48.145 ERROR: Caused by: Socket closed
 03:28:48.145 ERROR: Process returned exit code 1
                       The SonarQube Scanner did not complete successfully
 03:28:48.247  Creating a summary markdown file...
 03:28:48.271  Post-processing failed. Exit code: 1`

(Julien Henry) #4

The content of the scanner report has changed a lot between 5.2 and 6.7, and the size has also probably increased (you can check report size by enabling verbose logs on Scanner side). There is maybe something that your proxy reject. I remember people having an antivirus check inside their proxy, and it was causing a timeout because it was taking too much time to unzip the report and analyze.
If you have logs in your proxy, please check.

Also if you are on a corporate network, maybe try to skip the proxy between scanner and SQ server, it will prevent you from facing such issues.


(sonaruser) #5

I have tried disabling the proxy and also increasing the timeout (sonar.ws.timeout) to 1000 seconds in SonarQube analysis configuration with no luck.


(Julien Henry) #6

What is the size of the report?


(sonaruser) #7

I don’t see a zip file in the report folder. However, based on the scanner log output the zip size is 5 MB.

 `INFO: Analysis report generated in 53562ms, dir size=21 MB
  INFO: Analysis reports compressed in 59552ms, zip size=5 MB
  INFO: Analysis report generated in K:\xxxxx\.sonarqube\out\.sonar\scanner-report`

(Julien Henry) #8

Uploading 5 MB should be super fast on a “normal” network. I don’t think increasing the timeout (which is 60s by default AFAIR) is the way to go.

I suggest you focus on your proxy configuration. Maybe ask to have an exclusion for the SonarQube endpoint.


(sonaruser) #9

Hi Julien,
I did try both bypassing and disabling the proxy through internet explorer. The result is same. Am I missing something? Are there other places where I need to bypass the proxy?

I agree with you on the size of the report being the reason; I confirmed this by running scan on a smaller code set where the scanner could successfully upload the analysis report to server. Issue occurs only when I run the scan on the entire code base which generates relatively bigger report.

Appreciate any other clues you may be able to provide.

Thanks.


(Julien Henry) #10

Hi,

This is hard to tell how to configure the proxy exclusion (depends on your OS and proxy). Can’t you get some help from your IT department?