SonarQube report upload throwing SocketTimeOutException


(Abdul) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube - 6.7.5 - Community Edition.
    Sonar Scanner - 3.0.3.778

  • what are you trying to achieve
    I ran the sonar scanner for a project having 10 java source code files . The sonar scanner completed the analysis and uploaded the report to sonar qube successfully. The reports were also generated successfully in SonarQube.

    When i try to execute sonar analysis on bigger project having more than 260 java source code files. the Sonar scanner completed the analysis and during the upload of report to Sonar qube, the sonar scanner throws SocketTimeOutException is thrown.

  • what have you tried so far to achieve this
    add property to sonar-project.properties
    sonar.ws.timeout to increase the timeout


(G Ann Campbell) #2

Hi,

Could you please provide the exact error?

 
Thx,
Ann


(Abdul) #3

Hi Ann,
Thanks for the response.
Please find the below stack trace. i also tried using sonar.ws.timeout parameter in sonar-project.properties file.

java.lang.IllegalStateException: Fail to request http://localhost:9000/api/ce/submit?projectKey=myproject&projectName=test
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:190)
    at org.sonarqube.ws.client.HttpConnector.post(HttpConnector.java:155)
    at org.sonarqube.ws.client.HttpConnector.call(HttpConnector.java:114)
    at org.sonar.scanner.bootstrap.ScannerWsClient.call(ScannerWsClient.java:73)
    at org.sonar.scanner.report.ReportPublisher.upload(ReportPublisher.java:189)
    at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:135)
    at org.sonar.scanner.phases.PublishPhaseExecutor.publishReportJob(PublishPhaseExecutor.java:73)
    at org.sonar.scanner.phases.PublishPhaseExecutor.executeOnRoot(PublishPhaseExecutor.java:55)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:93)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
    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:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
    at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.net.SocketTimeoutException: timeout
    at okio.Okio$4.newTimeoutException(Okio.java:227)
    at okio.AsyncTimeout.exit(AsyncTimeout.java:284)
    at okio.AsyncTimeout$2.read(AsyncTimeout.java:240)
    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:344)
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:216)
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
    at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at org.sonarqube.ws.client.OkHttpClientBuilder.addHeaders(OkHttpClientBuilder.java:207)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
    at okhttp3.RealCall.execute(RealCall.java:69)
    at org.sonarqube.ws.client.HttpConnector.doCall(HttpConnector.java:188)
    ... 35 more
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at okio.Okio$2.read(Okio.java:138)
    at okio.AsyncTimeout$2.read(AsyncTimeout.java:236)

(G Ann Campbell) #4

Hi,

Are you running analysis on the same machine that’s hosing your SonarQube instance?

 
Ann


(Abdul) #5

Yes. I am running both sonar scanner and sonar qube in the same machine.


(G Ann Campbell) #6

Hi,

Are there any errors in the server logs?

 
Ann


(Duarte Meneses) #7

This is a wild guess, but maybe one of both processes (scanner or the compute engine) doesn’t have enough memory to process the bigger report.
Could you please try increasing heap size of both processes?


(Abdul) #8

I checked the web.log and found upload errors

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.FileUploadException:  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.FileUploadException: 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

(G Ann Campbell) #9

Hi,

You’ve got a timeout on the client side and an interrupted transmission on the server side… do you have a proxy in the middle that could be interfering?

 
Ann


(Abdul) #10

Hi Ann,
There is no proxy between the client side and server. Both Scanner and Server are on the same machine. do i need to use any different version of sonar scanner?

SonarQube - 6.7.5 - Community Edition.
Sonar Scanner - 3.0.3.778


(G Ann Campbell) #11

Hi,

The current version of SonarQube Scanner is 3.2, so upgrading wouldn’t hurt. At the same time, you should give Duarte’s suggestion a try.

 
Ann


(Abdul) #12

Hi , I also tried to Duarte’s suggestion, still no luck so far.


(Martin) #15

Just wondering whether this issue resolved or not?

I am also getting the same error at the client side and server side.
I am using the sonar scanner for type-script. here is the details.

sonar-project.properties
sonar.projectKey=test
sonar.projectName=test
sonar.projectVersion=2.0.1
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.ws.timeout=6000
sonar.exclusions=/node_modules/,/*.spec.ts,/.test.ts, /shared/
sonar.tests=src
sonar.test.inclusions=**/
.test.ts
sonar.ts.tslintconfigpath=tslint.json
sonar.typescript.lcov.reportPaths=coverage/lcov.info
sonar.log.level=TRACE
sonar.verbose=true

package.json
“gulp”: “^3.9.1”,
“gulp-cli”: “^2.0.1”,
“sonarqube-scanner”: “^2.1.2”,
“tslint”: “^5.7.0”,
“tslint-sonarts”: “^1.0.0”,
“typescript”: “^3.0.0”,

error at client side
09:47:11.788 INFO: Analysis report generated in 3218ms, dir size=752 KB
09:47:12.822 INFO: Analysis reports compressed in 1033ms, zip size=312 KB
09:47:12.823 INFO: Analysis report generated in C:\TFS\Git\bizworks-report-pmvrpt-ui\client.scannerwork\scanner-report
09:47:12.824 DEBUG: Upload report
09:49:13.164 INFO: ------------------------------------------------------------------------
09:49:13.170 INFO: EXECUTION FAILURE
09:49:13.176 INFO: ------------------------------------------------------------------------
09:49:13.187 INFO: Total time: 4:03.648s
09:49:13.321 INFO: Final Memory: 16M/678M
09:49:13.329 INFO: ------------------------------------------------------------------------
09:49:13.330 ERROR: Error during SonarQube Scanner execution
09:49:13.330 ERROR: Fail to request http://localhost:9000/api/ce/submit?projectKey=test&projectName=test
09:49:13.332 ERROR: Caused by: timeout
09:49:13.336 ERROR:
09:49:13.338 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
[09:49:13] ‘sonar’ errored after 4.08 min


(Martin) #16

Ann,

Any update will be greatly appreciated.

thanks,


(Abdul) #17

It had something to do with the our network policy setting on our windows machine, where network connection was always timing out consistently after 20 seconds.
When I ran the same sonar scanner from one of the Linux servers, the sonar reports were uploaded successfully.

Hope it helps…


(G Ann Campbell) #18

Thanks for posting your followup @asta! I’m sure this will help others.


(Martin) #19

Its simply works fine from linux build server but not from local windows 10 PC.

@ganncamp,

It would be great if SonarQube team can find the actual cause and provide the resolution as its happening with multiple folks.

Please let me know if you need additional information.