New sonar project - INVALID HASH exception


(Jason) #1

Sorry for double posting, but I got some comments to pull the individual issues out into separate posts to make it easier to track and to supply all of the information.

Must-share information:

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Server 1

  • 7.1.0.11001, via official Sonarqube docker image - no proxy.
    ( running via docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube)

Server 2

  • PostgreSQL, 10.1

Local dev environment

  • SonarQube Scanner 3.2.0.1227

  • All running on Ubuntu 16.04

Plugins

  • C++ community 1.0.0
  • Checkstyle 4.10
  • Git 1.4.1.1128
  • GitHub 1.4.2
  • GitHub Auth 1.3
  • Groovy 1.5
  • LDAP 2.2
  • SonarGo 1.1.0
  • SonarJS 4.1
  • SonarJava 5.4
  • SonarPython 1.10
  • SonarTS 1.7
  • SonarXML 1.5.1

This is a brand new install, I had one project setup initially.

  • what are you trying to achieve
    I want to run a scan without having to restart the server.

  • what have you tried so far to achieve this

I setup a new project initially and got this has error. I found that after restarting the Sonarqube server the issue would go away until I would run the scan again.
I decided to try a second project and I got the hash error the very first time that I ran the scan.

> sonar-scanner -X

13:35:04.925 INFO: Scanner configuration file: NONE
13:35:04.928 INFO: Project root configuration file: /home/user/myproj/src/sonar-project.properties
13:35:04.940 INFO: SonarQube Scanner 3.2.0.1227
13:35:04.941 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
13:35:04.941 INFO: Linux 4.10.0-28-generic amd64
13:35:05.013 DEBUG: keyStore is : 
13:35:05.014 DEBUG: keyStore type is : jks
13:35:05.014 DEBUG: keyStore provider is : 
13:35:05.014 DEBUG: init keystore
13:35:05.014 DEBUG: init keymanager of type SunX509
13:35:05.057 DEBUG: Create: /home/user/.sonar/cache
13:35:05.058 INFO: User cache: /home/user/.sonar/cache
13:35:05.058 DEBUG: Create: /home/user/.sonar/cache/_tmp
13:35:05.059 DEBUG: Extract sonar-scanner-api-batch in temp...
13:35:05.062 DEBUG: Get bootstrap index...
13:35:05.062 DEBUG: Download: (http)://172.16.x.xxx/batch/index
13:35:05.138 DEBUG: Get bootstrap completed
13:35:05.145 DEBUG: Create isolated classloader...
13:35:05.152 DEBUG: Start temp cleaning...
13:35:05.156 DEBUG: Temp cleaning done
13:35:05.157 DEBUG: Execution getVersion
13:35:05.158 INFO: SonarQube server 7.1.0
13:35:05.158 INFO: Default locale: "en_US", source code encoding: "UTF-8"
13:35:05.159 DEBUG: Work directory: /home/user/myproj/src/.scannerwork
13:35:05.159 DEBUG: Execution execute
13:35:05.246 INFO: Publish mode
13:35:05.306 INFO: Load global settings
13:35:05.376 DEBUG: GET 200 (http)://172.16.x.xxx/api/settings/values.protobuf | time=66ms
13:35:05.398 INFO: Load global settings (done) | time=92ms
13:35:05.403 INFO: Server id: AWQZlG0MHi-hVI6jqIjy
13:35:05.407 INFO: User cache: /home/user/.sonar/cache
13:35:05.562 INFO: Load plugins index
13:35:05.590 DEBUG: GET 200 (http)://172.16.x.xxx/api/plugins/installed | time=28ms
13:35:05.618 INFO: Load plugins index (done) | time=57ms
13:35:05.618 INFO: Load/download plugins
13:35:05.624 DEBUG: Download plugin 'sonar-go-plugin-1.1.0.1612.jar' to '/home/user/.sonar/cache/_tmp/fileCache886968126572092947.tmp'
13:35:05.659 DEBUG: GET 200 (http)://172.16.x.xxx/deploy/plugins/go/sonar-go-plugin-1.1.0.1612.jar | time=35ms
13:35:06.001 INFO: ------------------------------------------------------------------------
13:35:06.001 INFO: EXECUTION FAILURE
13:35:06.001 INFO: ------------------------------------------------------------------------
13:35:06.002 INFO: Total time: 1.090s
13:35:06.050 INFO: Final Memory: 46M/960M
13:35:06.050 INFO: ------------------------------------------------------------------------
13:35:06.050 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: INVALID HASH: File /home/user/.sonar/cache/_tmp/fileCache886968126572092947.tmp was expected to have hash 422534b0c74c3b556431243cad6a922a but was downloaded with hash 05b8716296f0a4fdbd741af867516597
	at org.sonar.home.cache.FileCache.cacheMiss(FileCache.java:98)
	at org.sonar.home.cache.FileCache.get(FileCache.java:88)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.download(ScannerPluginInstaller.java:99)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.loadPlugins(ScannerPluginInstaller.java:75)
	at org.sonar.scanner.bootstrap.ScannerPluginInstaller.installRemotes(ScannerPluginInstaller.java:65)
	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:134)
	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:171)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
	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)

Configuration

########################################################
# SonarQube Properties
# must be unique in a given SonarQube instance
########################################################
sonar.projectKey=myproj
sonar.sources=myproj
sonar.projectBaseDir=.
sonar.host.url=http://172.16.x.xxx
sonar.login=xxx

########################################################
# General settings
#######################################################
sonar.sourceEncoding=UTF-8
sonar.exclusions=**/.git/**, **/
sonar.coverage.exclusions=**/.git/**
sonar.cpd.exclusions=**/.git/**

#######################################################
# List of the module identifiers
#######################################################
sonar.modules=src/common-lib
common-lib.sonar.projectName=common-lib
common-lib.sonar.sources=src/common-lib/source/python/dc_common

########################################################
# Pylint configuration
#######################################################
# Unit tests
common-lib.sonar.python.coverage.reportPath=src/common-lib/source/python/dc_common//test/python_coverage.xml

#######################################################
# Git configuration
#######################################################
sonar.github.repository=myproj