Fail to download plugin [scmsvn]


(Idan Adar) #1

Hello,

I’m running sonar-scanner in a Docker-based Jenkins agent on a Docker Swarm.
When my pipeline reaches the scanning stage, it fails with the following:

[Pipeline] stage
[Pipeline] { (SonarQube analysis)
[Pipeline] withEnv
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: CertificateManager
[Pipeline] {
[Pipeline] sh
+ sonar-scanner
INFO: Scanner configuration file: /bin/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/jenkins/workspace/Service_API_PR-572/sonar-project.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_191 Oracle Corporation (64-bit)
INFO: Linux 4.4.0-112-generic amd64
INFO: User cache: /home/jenkins/.sonar/cache
INFO: SonarQube server 7.3.0
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=457ms
INFO: Server id: 7DB33681-AVrl7C9QqWhy8dWNHdVz
INFO: User cache: /home/jenkins/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=237ms
INFO: Load/download plugins (done) | time=9333ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 58.453s
INFO: Final Memory: 53M/1963M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Fail to download plugin [scmsvn] into /home/jenkins/.sonar/_tmp/fileCache4096557195300578345.tmp
ERROR: Caused by: Connection reset
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?

Sometimes also with

ERROR: Caused by: timeout
ERROR: Caused by: Socket closed

Instead of:

ERROR: Caused by: Connection reset

When not running on a Docker agent, this never fails.
I then tried to run it with the +X flag and the stacktrace shows pretty much that it times out.

1:48:35.191 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Fail to download plugin [scmsvn] into /home/jenkins/.sonar/_tmp/fileCache6964444904727325799.tmp
    at org.sonar.scanner.bootstrap.PluginFiles.downloadBinaryTo(PluginFiles.java:151)
    at org.sonar.scanner.bootstrap.PluginFiles.download(PluginFiles.java:107)
    at org.sonar.scanner.bootstrap.PluginFiles.get(PluginFiles.java:89)
    at org.sonar.scanner.bootstrap.ScannerPluginInstaller.loadPlugins(ScannerPluginInstaller.java:80)
    at org.sonar.scanner.bootstrap.ScannerPluginInstaller.installRemotes(ScannerPluginInstaller.java:62)
    at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
...
...
...
Caused by: java.net.SocketTimeoutException: timeout

(Idan Adar) #3

Is it possible to increase this timeout? Can anyone think of something else that may be happening here?


(Duarte Meneses) #4

Hi,
Looks like you have a network problem with your docker swarm. Only thing I can suggest is to run the scan with debug logs enabled, so that you have more details about what is downloaded.
The SCM SVN plugin is not even that big (6-7MB) so it should definitely not timeout.


(Idan Adar) #5

The above stacktrace is with +X, debug mode, no? It just says timeout…

Everything works in the Docker agent except for Sonar scanner.
Is it possible to install these plug-ins manually in the Dockerfile instead of have Sonar scanner download them each scan?

Edit: Sorry, yeah, meant -X.


(Duarte Meneses) #6

I don’t see any debug logs. The argument is -X.
Files get cached based on their hash so it would be difficult to install them manually.
What if you try to download plugins with for example curl? does it work?


(Idan Adar) #7

This is the full log, with -X.
It seems it’s able to download them, but fails for scmsvn. Do I even need this plug-in? Any non-language plug-ins I can disable?

+ sonar-scanner -X
21:17:15.641 INFO: Scanner configuration file: /bin/sonar-scanner/conf/sonar-scanner.properties
21:17:15.645 INFO: Project root configuration file: /home/jenkins/workspace/Service_API_PR-576/sonar-project.properties
21:17:15.679 INFO: SonarQube Scanner 3.3.0.1492
21:17:15.680 INFO: Java 1.8.0_191 Oracle Corporation (64-bit)
21:17:15.680 INFO: Linux 4.4.0-112-generic amd64
21:17:15.826 DEBUG: keyStore is : 
21:17:15.826 DEBUG: keyStore type is : jks
21:17:15.826 DEBUG: keyStore provider is : 
21:17:15.826 DEBUG: init keystore
21:17:15.826 DEBUG: init keymanager of type SunX509
21:17:15.910 DEBUG: Create: /home/jenkins/.sonar/cache
21:17:15.911 INFO: User cache: /home/jenkins/.sonar/cache
21:17:15.911 DEBUG: Create: /home/jenkins/.sonar/cache/_tmp
21:17:15.914 DEBUG: Extract sonar-scanner-api-batch in temp...
21:17:15.922 DEBUG: Get bootstrap index...
21:17:15.923 DEBUG: Download: http://****.com:9000/sonarqube/batch/index
21:17:16.592 DEBUG: Get bootstrap completed
21:17:16.603 DEBUG: Download http://****.com:9000/sonarqube/batch/file?name=sonar-scanner-engine-shaded-7.3-all.jar to /home/jenkins/.sonar/cache/_tmp/fileCache5832500668472806166.tmp
21:17:51.849 DEBUG: Create isolated classloader...
21:17:51.858 DEBUG: Start temp cleaning...
21:17:51.865 DEBUG: Temp cleaning done
21:17:51.866 DEBUG: Execution getVersion
21:17:51.868 INFO: SonarQube server 7.3.0
21:17:51.868 INFO: Default locale: "en_US", source code encoding: "UTF-8"
21:17:51.869 DEBUG: Work directory: /home/jenkins/workspace/Service_API_PR-576/.scannerwork
21:17:51.870 DEBUG: Execution execute
21:17:52.081 INFO: Publish mode
21:17:52.245 INFO: Load global settings
21:17:52.733 DEBUG: GET 200 http://****.com:9000/sonarqube/api/settings/values.protobuf | time=471ms
21:17:52.766 INFO: Load global settings (done) | time=522ms
21:17:52.773 INFO: Server id: 7DB33681-AVrl7C9QqWhy8dWNHdVz
21:17:52.784 DEBUG: Create : /home/jenkins/.sonar/_tmp
21:17:52.784 INFO: User cache: /home/jenkins/.sonar/cache
21:17:52.989 INFO: Load/download plugins
21:17:52.989 INFO: Load plugins index
21:17:53.203 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/installed | time=214ms
21:17:53.235 INFO: Load plugins index (done) | time=246ms
21:17:53.237 DEBUG: Download plugin 'scmgit' to '/home/jenkins/.sonar/_tmp/fileCache7249122415047048931.tmp'
21:17:53.449 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=scmgit&acceptCompressions=pack200 | time=212ms
21:17:55.124 DEBUG: Download plugin 'ldap' to '/home/jenkins/.sonar/_tmp/fileCache4619085865521767948.tmp'
21:17:55.336 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=ldap&acceptCompressions=pack200 | time=212ms
21:17:55.375 DEBUG: Download plugin 'cssfamily' to '/home/jenkins/.sonar/_tmp/fileCache6933705004194084555.tmp'
21:17:55.586 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=cssfamily&acceptCompressions=pack200 | time=211ms
21:17:56.104 DEBUG: Download plugin 'go' to '/home/jenkins/.sonar/_tmp/fileCache6629983248364880098.tmp'
21:17:56.316 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=go&acceptCompressions=pack200 | time=212ms
21:17:56.613 DEBUG: Download plugin 'javascript' to '/home/jenkins/.sonar/_tmp/fileCache2703855352878611446.tmp'
21:17:56.829 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=javascript&acceptCompressions=pack200 | time=216ms
21:17:57.372 DEBUG: Download plugin 'java' to '/home/jenkins/.sonar/_tmp/fileCache2724790876340826213.tmp'
21:17:57.583 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=java&acceptCompressions=pack200 | time=211ms
21:17:58.283 DEBUG: Download plugin 'scmsvn' to '/home/jenkins/.sonar/_tmp/fileCache5460971812863908067.tmp'
21:17:58.496 DEBUG: GET 200 http://****.com:9000/sonarqube/api/plugins/download?plugin=scmsvn&acceptCompressions=pack200 | time=212ms
21:18:58.974 INFO: Load/download plugins (done) | time=65985ms
21:18:58.977 INFO: ------------------------------------------------------------------------
21:18:58.977 INFO: EXECUTION FAILURE
21:18:58.977 INFO: ------------------------------------------------------------------------
21:18:58.977 INFO: Total time: 1:43.353s
21:18:59.066 INFO: Final Memory: 55M/1963M
21:18:59.067 INFO: ------------------------------------------------------------------------
21:18:59.067 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Fail to download plugin [scmsvn] into /home/jenkins/.sonar/_tmp/fileCache5460971812863908067.tmp
	at org.sonar.scanner.bootstrap.PluginFiles.downloadBinaryTo(PluginFiles.java:151)
	at org.sonar.scanner.bootstrap.PluginFiles.download(PluginFiles.java:107)
	at org.sonar.scanner.bootstrap.PluginFiles.get(PluginFiles.java:89)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.loadPlugins(ScannerPluginInstaller.java:80)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.installRemotes(ScannerPluginInstaller.java:62)
	at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:59)
	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.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
	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:135)
	at org.sonar.batch.bootstrapper.Batch.doStart(Batch.java:94)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:69)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	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:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	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.read(RealBufferedSource.java:45)
	at okhttp3.internal.http1.Http1Codec$ChunkedSource.read(Http1Codec.java:429)
	at okio.RealBufferedSource$1.read(RealBufferedSource.java:429)
	at java.io.InputStream.read(InputStream.java:101)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2314)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:2270)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:2246)
	at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1530)
	at org.apache.commons.io.FileUtils.copyInputStreamToFile(FileUtils.java:1506)
	at org.sonar.scanner.bootstrap.PluginFiles.downloadBinaryTo(PluginFiles.java:149)
	... 33 more
Caused by: java.net.SocketException: Socket closed
	at java.net.SocketInputStream.read(SocketInputStream.java:204)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at okio.Okio$2.read(Okio.java:138)
	at okio.AsyncTimeout$2.read(AsyncTimeout.java:236)
	... 44 more

(Idan Adar) #8

I uninstall some of the unused plug-ins that get downloaded, scmsvn included. Now it works…