Fail to parse entry in bootstrap index returned from sonar-scanner


(Adrian Blakey) #1

Any ideas?

In a Jenkins pipeline I am running:

  • sonar-scanner version with -X
  • Test project om called: sonar-scanning-examples-master/sonarqube-scanner
  • RH Linux
  • Up against a 7.1 SonarQube server
  • It’s hidden behind a nginx https proxy, with trusted SAN certs.
  • SONAR_SCANNER_OPTS= -Xmx512m -Dnet.ssl.trustStorePassword=changeit

If I hit https://sonarserver/batch/index with a browser it replies: sonar-scanner-engine-shaded-7.1-all.jar|3e26d9ec2d452f29e27358939e592296

Error output:

16:57:59.767 DEBUG: keyStore is :
16:57:59.767 DEBUG: keyStore type is : jks
16:57:59.767 DEBUG: keyStore provider is :
16:57:59.767 DEBUG: init keystore
16:57:59.767 DEBUG: init keymanager of type SunX509
16:57:59.861 DEBUG: Create: /var/lib/jenkins/.sonar/cache
16:57:59.861 INFO: User cache: /var/lib/jenkins/.sonar/cache
16:57:59.862 DEBUG: Create: /var/lib/jenkins/.sonar/cache/_tmp
16:57:59.864 DEBUG: Extract sonar-scanner-api-batch in temp...
16:57:59.869 DEBUG: Get bootstrap index...
16:57:59.869 DEBUG: Download: https://aw-lx0287.deltadev.ent/batch/index
16:58:00.129 DEBUG: Get bootstrap completed
16:58:00.130 INFO: ------------------------------------------------------------------------
16:58:00.130 INFO: ------------------------------------------------------------------------
16:58:00.130 INFO: Total time: 0.498s
16:58:00.154 INFO: Final Memory: 7M/479M
16:58:00.154 INFO: ------------------------------------------------------------------------
16:58:00.155 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(
at Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(
at org.sonarsource.scanner.api.EmbeddedScanner.start(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.main(
Caused by: java.lang.IllegalStateException: Fail to parse entry in bootstrap index: <!DOCTYPE html><html lang="en"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"><link rel="apple-touch-icon" href="/apple-touch-icon.png"><link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"><link rel="icon" type="image/x-icon" href="/favicon.ico"><meta name="application-name" content="SonarQube"/><meta name="msapplication-TileColor" content="#FFFFFF"/><meta name="msapplication-TileImage" content="/mstile-512x512.png"/><link href="/css/main.e04508c4.css" rel="stylesheet"><title>Loading...</title></head><body><div id="content"><div class="global-loading"><i class="spinner global-loading-spinner"></i> <span class="global-loading-text">Loading...</span></div></div><script>window.baseUrl=""</script><script src="/js/vendors~main.57ecd91f.chunk.js"></script><script src="/js/main.e04508c4.js"></script></body></html>
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.parse(
at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(
... 7 more

(G Ann Campbell) #2


This looks like an issue with your proxy. If you can, try an analysis that bypasses the proxy & you should see everything work as expected.


(Adrian Blakey) #3

Ann - sorry to say that does not help me very much.

Another bit of information …

The issue occurs in a jenkins job, which implements a repeatable process to create and provision dockers for the nginx proxy, sq, and postgres. The job works just fine and has done for several months. The containers run and I can successfully process scans from sonar-scanner against them from other jenkins build pipelines.

The reported issues occur in a newly added build step to run an automated test of the build-started images.

I had thought that the issue occurred because the test was being run before the server had initialized. I believe I have ruled this out by putting a wait in the pipeline and hitting the server URL with curl (to simulate a browser interaction) before running the test. However that does not seem to have done the trick.

I also notice that there is another post in this forum that looks suspiciously similar that report the same issue occurring from jenkins. Issue regarding sonarqube jenkins integration

No clear resolution in the post …

I suppose the next step is to try kicking off the test in a subsequent build and see if that will run the test - not an elegant solution. I’d prefer a real fix.

(G Ann Campbell) #4


To be clear, analysis runs just fine, and the issue you’re seeing is coming from some non-analysis test of the SonarQube instance? If that’s the case, I’m not sure I can help you much.

That said, I do notice that your SONAR_SCANNER_OPTS value is a bit odd. The memory setting is perfectly normal there, although it should be right after the =, with no spaces in between. The key/value pair simply doesn’t belong there. Nor, I think, do the trustStore pairs. (Docs.)


(Adrian Blakey) #5

No, the analysis, run after the docker images are build and started executing, followed by a short wait to make sure they up, followed by a “ping” from a curl to the server URL, does not run - the traceback shows the failure. However if I subsequently run the same sonar-scanner test from a command line - it works just fine.

TY. I’ll adjust the opts and retry …

(G Ann Campbell) #6


Okay, so for each project / analysis you’re spinning up a new Docker container with an independent SonarQube instance? And if so why?

If I’m understanding correctly what you’re doing, you probably don’t want to be doing a simple “ping” but probably using the api/system/health check instead.


(Adrian Blakey) #7

No. A single stack of nginx/SQ/postgres to serve multiple scans. Done in a build process followed by an automated test. I’ll try the suggested api … more as I know more…


(Adrian Blakey) #9

Fixed it … seems like it was a timing issue waiting for the server to initialize …

This snippet does the trick …

echo "Ping the server"
# Wait for server to initialize - 3 states - html, json red, json green
set +e
while true; do
   sleep 10
   resp=$(curl -s -u admin:admin ${URL}/api/system/health | grep 'html')
   if [ -z $resp ] ; then
set -e
# And for real ...
while true; do
  sleep 5
  state=$(curl -s -u admin:admin ${URL}/api/system/health | jq -r  '.health')
  if [ "${state}" == 'GREEN' ] ; then

And the execution has to be set up like this to call sonar-scanner, otherwise the certs are refused:

export SONAR_SCANNER_OPTS="-Xmx512m -Dsonar.verbose=true${URL}${certs} -Dnet.ssl.trustStorePassword=changeit"    
export PATH=`pwd`/scanner/sonar-scanner-${ssv}-linux/bin:$PATH:/usr/lib/jvm/java-1.8.0/bin                                                                     
# run it on a project                                                                                                                                          
    cd `pwd`/scanner/tests/sonar-scanning-examples-master/sonarqube-scanner                                                                                      
    sonar-scanner -X