Sonar Scanner stuck when downloading Sonarqube index

Hi,

when launching sonar scanner command it hangs for about 5 minutes and then returns a timeout.
I am using SonarScanner 4.2 and SonarQube 7.9.1 (dockerized) on Mac and followed the instructions on the site.
Does anyone know what can be the cause?
http://localhost:9000 is responding and I was able to login as admin and generate the token

The command that I launch is the following:

sonar-scanner   -Dsonar.projectKey=projdev   -Dsonar.sources=.   -Dsonar.host.url=http://localhost:9000   -Dsonar.login=XXXXXXXXXXXXXXXXXXXXXX -X -e

Here there is the error stack trace:

12:26:29.360 DEBUG: Get bootstrap index...    
12:26:29.360 DEBUG: Download: http://localhost:9000/batch/index    
12:31:29.412 INFO: ------------------------------------------------------------------------    
12:31:29.413 INFO: EXECUTION FAILURE    
12:31:29.413 INFO: ------------------------------------------------------------------------    
12:31:29.414 INFO: Total time: 5:00.244s    
12:31:29.431 INFO: Final Memory: 3M/20M    
12:31:29.431 INFO: ------------------------------------------------------------------------    
12:31:29.432 ERROR: Error during SonarQube Scanner execution    
    org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube    
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)    
    at java.base/java.security.AccessController.doPrivileged(Native Method)    
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)    
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)    
    at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)    
    at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)    
    at org.sonarsource.scanner.cli.Main.execute(Main.java:73)    
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)    
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server    
    at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)    
    at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)    
    at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)    
    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)    
    ... 7 more    
Caused by: java.net.SocketTimeoutException: timeout    
    at org.sonarsource.scanner.api.internal.shaded.okio.Okio$4.newTimeoutException(Okio.java:232)    
    at org.sonarsource.scanner.api.internal.shaded.okio.AsyncTimeout.exit(AsyncTimeout.java:286)    
    at org.sonarsource.scanner.api.internal.shaded.okio.AsyncTimeout$2.read(AsyncTimeout.java:241)    
    at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource.read(RealBufferedSource.java:51)    
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.java:389)    
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http1.Http1ExchangeCodec$UnknownLengthSource.read(Http1ExchangeCodec.java:529)    
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.Exchange$ResponseBodySource.read(Exchange.java:286)    
    at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource.select(RealBufferedSource.java:100)    
    at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.Util.bomAwareCharset(Util.java:467)    
    at org.sonarsource.scanner.api.internal.shaded.okhttp.ResponseBody.string(ResponseBody.java:181)    
    at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)    
    at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)    
    ... 10 more    
Caused by: java.net.SocketTimeoutException: Read timed out    
    at java.base/java.net.SocketInputStream.socketRead0(Native Method)    
    at java.base/java.net.SocketInputStream.socketRead(Unknown Source)    
    at java.base/java.net.SocketInputStream.read(Unknown Source)    
    at java.base/java.net.SocketInputStream.read(Unknown Source)    
    at org.sonarsource.scanner.api.internal.shaded.okio.Okio$2.read(Okio.java:140)    
    at org.sonarsource.scanner.api.internal.shaded.okio.AsyncTimeout$2.read(AsyncTimeout.java:237)    
    ... 19 more

I found out the problem. I don’t know why, since localhost:9000 is correctly responding, but ZScaler was blocking the traffic between sonar-scanner and Sonarquebe instance.
Shutting down ZScaler resolved the issue

3 Likes

Thanks. This was my issue also.

1 Like