which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube server 8.9.0 (community edition)
SonarScanner 4.6.2.2472
Java 11.0.11 AdoptOpenJDK (64-bit)
Linux 5.10.25-linuxkit amd64
what are you trying to achieve
Trying to do a sonar scan
what have you tried so far to achieve this
Always timing out in 60secs
Is there a way to increase the timeout?
Logs Output
15:46:50.978 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
15:46:50.982 INFO: Project root configuration file: NONE
15:46:51.044 INFO: SonarScanner 4.6.2.2472
15:46:51.045 INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
15:46:51.045 INFO: Linux 5.10.25-linuxkit amd64
15:46:51.270 DEBUG: keyStore is :
15:46:51.270 DEBUG: keyStore type is : pkcs12
15:46:51.271 DEBUG: keyStore provider is :
15:46:51.271 DEBUG: init keystore
15:46:51.271 DEBUG: init keymanager of type SunX509
15:46:51.456 DEBUG: Create: /opt/sonar-scanner/.sonar/cache
15:46:51.457 INFO: User cache: /opt/sonar-scanner/.sonar/cache
15:46:51.457 DEBUG: Create: /opt/sonar-scanner/.sonar/cache/_tmp
15:46:51.461 DEBUG: Extract sonar-scanner-api-batch in temp...
15:46:51.466 DEBUG: Get bootstrap index...
15:46:51.466 DEBUG: Download: https://sonarqube.domain.com/batch/index
15:46:52.590 DEBUG: Get bootstrap completed
15:46:52.597 DEBUG: Download https://sonarqube.domain.com/batch/file?name=sonar-scanner-engine-shaded-8.9.0.43852-all.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache16445368501716957092.tmp
15:47:52.009 INFO: ------------------------------------------------------------------------
15:47:52.009 INFO: EXECUTION FAILURE
15:47:52.009 INFO: ------------------------------------------------------------------------
15:47:52.010 INFO: Total time: 1:01.044s
15:47:52.026 INFO: Final Memory: 3M/14M
15:47:52.026 INFO: ------------------------------------------------------------------------
15:47:52.026 ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
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 download sonar-scanner-engine-shaded-8.9.0.43852-all.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache16445368501716957092.tmp
at org.sonarsource.scanner.api.internal.cache.FileCache.download(FileCache.java:100)
at org.sonarsource.scanner.api.internal.cache.FileCache.get(FileCache.java:84)
at org.sonarsource.scanner.api.internal.JarDownloader.lambda$getScannerEngineFiles$0(JarDownloader.java:60)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:61)
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: org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http2.StreamResetException: stream was reset: CANCEL
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http2.Http2Stream$FramingSource.read(Http2Stream.java:384)
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$1.read(RealBufferedSource.java:447)
at java.base/java.io.InputStream.transferTo(Unknown Source)
at java.base/java.nio.file.Files.copy(Unknown Source)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadFile(ServerConnection.java:82)
at org.sonarsource.scanner.api.internal.JarDownloader$ScannerFileDownloader.download(JarDownloader.java:73)
at org.sonarsource.scanner.api.internal.cache.FileCache.download(FileCache.java:98)
... 19 more
The Docker Hub page says “SonarScanner is the official scanner used to run code analysis on SonarQube and SonarCloud.”
The SonarScanner does not perform the analysis; it is the client for the source analysis, and you need an account on SonarCloud, or an instance of SonarQube, to be the server that hosts your analysis.
Either option is easy. Here is a 2-minute guide to Try Out SonarQube with Docker.
Yes, there a way to increase the timeout. The sonar.ws.timeoutanalysis parameter is the maximum seconds to wait for the response of a Web Service call. Since you’re experiencing timeouts, try setting it to a higher value.
I tried the sonar.ws.timeout settings, still getting the same error.
-Dsonar.ws.timeout=180
=> 3mins timeout
10:07:52.998 DEBUG: Download https://sonarqube.domain.com/batch/file?name=sonar-scanner-engine-shaded-8.9.0.43852-all.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache3130891023332126414.tmp
10:10:52.434 INFO: ------------------------------------------------------------------------
10:10:52.434 INFO: EXECUTION FAILURE
10:10:52.434 INFO: ------------------------------------------------------------------------
10:10:52.436 INFO: Total time: 3:01.357s
10:10:52.453 INFO: Final Memory: 3M/17M
10:10:52.453 INFO: ------------------------------------------------------------------------
10:10:52.453 ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
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 download sonar-scanner-engine-shaded-8.9.0.43852-all.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache3130891023332126414.tmp
at org.sonarsource.scanner.api.internal.cache.FileCache.download(FileCache.java:100)
at org.sonarsource.scanner.api.internal.cache.FileCache.get(FileCache.java:84)
at org.sonarsource.scanner.api.internal.JarDownloader.lambda$getScannerEngineFiles$0(JarDownloader.java:60)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:61)
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: org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http2.StreamResetException: stream was reset: CANCEL
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http2.Http2Stream$FramingSource.read(Http2Stream.java:384)
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$1.read(RealBufferedSource.java:447)
at java.base/java.io.InputStream.transferTo(Unknown Source)
at java.base/java.nio.file.Files.copy(Unknown Source)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadFile(ServerConnection.java:82)
at org.sonarsource.scanner.api.internal.JarDownloader$ScannerFileDownloader.download(JarDownloader.java:73)
at org.sonarsource.scanner.api.internal.cache.FileCache.download(FileCache.java:98)
... 19 more
But from the server-side access logs, I could see that the download is completed.
/opt/sonarqube/logs/access.log
As the timeout occurs during the download of sonar-scanner-engine-shaded-8.9.0.43852-all.jar to your temp volume, I suspect that the problem could be with either write access, or storage limits, on the /opt/sonar-scanner/.sonar/cache location of the filesystem.
The instructions at SonarScanner: Advanced Docker Configuration could help, with sections about running as a non-root user, caching scanner files, using self-signed certificates.
I don’t think it’s a file access (or) storage issue. Because sometimes it happens when downloading sonar-scanner-engine-shaded-8.9.0.43852-all.jar and sometimes it happens when downloading other plugins. If it’s a storage issue, then it should persistently fail at a single location. Also, I’m running this on my laptop, where I have enough storage space.
Check this latest log, this has failed during the download of ‘sonarscala’ plugin.
17:26:26.768 DEBUG: Get bootstrap index...
17:26:26.768 DEBUG: Download: https://sonarqube.analyticalwizards.com/batch/index
17:26:28.068 DEBUG: Get bootstrap completed
17:26:28.074 DEBUG: Download https://sonarqube.analyticalwizards.com/batch/file?name=sonar-scanner-engine-shaded-8.9.0.43852-all.jar to /opt/sonar-scanner/.sonar/cache/_tmp/fileCache17545405779935080233.tmp
17:26:46.370 DEBUG: Create isolated classloader...
17:26:46.382 DEBUG: Start temp cleaning...
17:26:46.386 DEBUG: Temp cleaning done
17:26:46.386 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
17:26:46.388 INFO: Project root configuration file: NONE
17:26:46.390 DEBUG: Execution getVersion
17:26:46.411 INFO: Analyzing on SonarQube server 8.9.0
17:26:46.411 INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
17:26:46.412 DEBUG: Work directory: /usr/src/.scannerwork
17:26:46.414 DEBUG: Execution execute
17:26:46.710 DEBUG: Community 8.9.0.43852
17:26:46.907 INFO: Load global settings
17:26:47.794 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/settings/values.protobuf | time=882ms
17:26:47.849 INFO: Load global settings (done) | time=942ms
17:26:47.860 INFO: Server id: 3F12CC8F-AXmyXEvHy8lFU-eekjYI
17:26:47.864 DEBUG: Create : /opt/sonar-scanner/.sonar/_tmp
17:26:47.865 INFO: User cache: /opt/sonar-scanner/.sonar/cache
17:26:47.869 INFO: Load/download plugins
17:26:47.869 INFO: Load plugins index
17:26:48.136 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/installed | time=267ms
17:26:48.268 INFO: Load plugins index (done) | time=399ms
17:26:48.273 DEBUG: Download plugin 'csharp' to '/opt/sonar-scanner/.sonar/_tmp/fileCache13800821382813935068.tmp'
17:26:48.529 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=csharp&acceptCompressions=pack200 | time=256ms
17:26:54.092 DEBUG: Download plugin 'cssfamily' to '/opt/sonar-scanner/.sonar/_tmp/fileCache8672043327126004635.tmp'
17:26:54.345 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=cssfamily&acceptCompressions=pack200 | time=253ms
17:26:58.952 DEBUG: Download plugin 'communityBranchPlugin' to '/opt/sonar-scanner/.sonar/_tmp/fileCache16449514999935942426.tmp'
17:26:59.202 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=communityBranchPlugin&acceptCompressions=pack200 | time=249ms
17:27:04.008 DEBUG: Download plugin 'flex' to '/opt/sonar-scanner/.sonar/_tmp/fileCache16803830122913118151.tmp'
17:27:04.275 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=flex&acceptCompressions=pack200 | time=266ms
17:27:05.546 DEBUG: Download plugin 'go' to '/opt/sonar-scanner/.sonar/_tmp/fileCache3608594026448815174.tmp'
17:27:05.795 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=go&acceptCompressions=pack200 | time=249ms
17:27:09.906 DEBUG: Download plugin 'web' to '/opt/sonar-scanner/.sonar/_tmp/fileCache2356994495394507103.tmp'
17:27:10.156 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=web&acceptCompressions=pack200 | time=250ms
17:27:11.136 DEBUG: Download plugin 'jacoco' to '/opt/sonar-scanner/.sonar/_tmp/fileCache4976131829177210697.tmp'
17:27:11.384 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=jacoco&acceptCompressions=pack200 | time=248ms
17:27:11.391 DEBUG: Download plugin 'java' to '/opt/sonar-scanner/.sonar/_tmp/fileCache14347472204908733139.tmp'
17:27:11.653 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=java&acceptCompressions=pack200 | time=262ms
17:27:28.178 DEBUG: Download plugin 'javascript' to '/opt/sonar-scanner/.sonar/_tmp/fileCache13780619018184784923.tmp'
17:27:28.433 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=javascript&acceptCompressions=pack200 | time=255ms
17:27:45.888 DEBUG: Download plugin 'kotlin' to '/opt/sonar-scanner/.sonar/_tmp/fileCache5992125475659314030.tmp'
17:27:46.164 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=kotlin&acceptCompressions=pack200 | time=276ms
17:27:53.323 DEBUG: Download plugin 'php' to '/opt/sonar-scanner/.sonar/_tmp/fileCache2482876241122988638.tmp'
17:27:53.578 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=php&acceptCompressions=pack200 | time=254ms
17:27:57.726 DEBUG: Download plugin 'python' to '/opt/sonar-scanner/.sonar/_tmp/fileCache4099206579811052356.tmp'
17:27:57.996 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=python&acceptCompressions=pack200 | time=269ms
17:28:01.232 DEBUG: Download plugin 'ruby' to '/opt/sonar-scanner/.sonar/_tmp/fileCache5361767873868545431.tmp'
17:28:01.495 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=ruby&acceptCompressions=pack200 | time=262ms
17:28:09.841 DEBUG: Download plugin 'sonarscala' to '/opt/sonar-scanner/.sonar/_tmp/fileCache11523861021043067335.tmp'
17:28:10.120 DEBUG: GET 200 https://sonarqube.analyticalwizards.com/api/plugins/download?plugin=sonarscala&acceptCompressions=pack200 | time=278ms
17:31:09.397 INFO: Load/download plugins (done) | time=261527ms
17:31:09.407 INFO: ------------------------------------------------------------------------
17:31:09.407 INFO: EXECUTION FAILURE
17:31:09.408 INFO: ------------------------------------------------------------------------
17:31:09.408 INFO: Total time: 4:43.079s
17:31:09.431 INFO: Final Memory: 5M/20M
17:31:09.431 INFO: ------------------------------------------------------------------------
17:31:09.431 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Fail to download plugin [sonarscala] into /opt/sonar-scanner/.sonar/_tmp/fileCache11523861021043067335.tmp
at org.sonar.scanner.bootstrap.PluginFiles.downloadBinaryTo(PluginFiles.java:158)
at org.sonar.scanner.bootstrap.PluginFiles.download(PluginFiles.java:114)
at org.sonar.scanner.bootstrap.PluginFiles.get(PluginFiles.java:89)
at org.sonar.scanner.bootstrap.ScannerPluginInstaller.loadPlugins(ScannerPluginInstaller.java:77)
at org.sonar.scanner.bootstrap.ScannerPluginInstaller.installRemotes(ScannerPluginInstaller.java:60)
at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:62)
at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
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:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.kt:358)
at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.kt:276)
at okio.RealBufferedSource$inputStream$1.read(RealBufferedSource.kt:158)
at java.base/java.io.InputStream.read(Unknown Source)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1158)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:878)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1135)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:854)
at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1086)
at org.apache.commons.io.FileUtils.copyInputStreamToFile(FileUtils.java:992)
at org.sonar.scanner.bootstrap.PluginFiles.downloadBinaryTo(PluginFiles.java:156)
... 29 more
I tried that too. I raised till 300 => 5mins and it’s still failing.
There seems to be some bug somewhere.
If you see the logs from the server, the log says download is completed with Status Code: 200.
But the scanner is still trying to download, and eventually timeout.
We figured that the issue was with ELB/Load Balancer.
We also tried with different Ingress controller and that worked fine without any timeout.
But currently, we have set up a pipeline within the cluster that will pull the code from the repo and send it to the sonar scanner using the Kubernetes service directly.
I am seeing this happen in overnight CI and still happening now: https://drone.owncloud.com/owncloud/core/33622/35/8 java.lang.IllegalStateException: Fail to download plugin [javascript] into /opt/sonar-scanner/.sonar/_tmp/fileCache17550887843177845817.tmp
I will start a new topic so that this gets noticed.
I’m still facing this issue. I do not want to remove the 60s LB timeout, because it is worrying that a request to sonarqube takes more then 60s to begin with, unless there is some web-sockets in play