ERROR: Error during SonarScanner execution in GitLab

Hello,

I’m using Sonarqube 9.9 for the project analysis which is deployed on the amazon-linux instance in the zip form. I’m doing the analysis through gitlab-CI.

Now there is one project on which I’m trying to run the analysis, but on running the gitlab job which is doing the analysis, the error mentioned in the header is coming.

I have tried clearing .sonar files before the analysis by adding

rm -rf .sonar

I also tried clearing the runner cache, I also tried running the analysis by Temporarily Disabling Cache by adding

-Dsonar.cpd.exclusions=**

in the sonar-scanner command.

Below is the .gitlab-ci.yml file for the analysis job:

sonarqube-check:
  image: 
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
    GIT_DEPTH: "0"
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script: 
    - sonar-scanner -X
  allow_failure: true
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      changes:
      - "**/*"
      when: always

I have attached the error below
error_log.txt (14.6 KB)

Hey there.

I don’t expect that either removing .sonar or setting -Dsonar.cpd.exclusions will have any effect here (you could try setting sonar.analysisCache.enabled=false, but this won’t fix the root cause!)

Could you turn on DEBUG level logs and attach the full logs? sonar-scanner -X.

Hi,

Thank you for your response, I have tried running the analysis by adding sonar.analysisCache.enabled=false and it is working, but as you stated that it won’t fix the root cause, so if I face this issue again in near future, I will post the DEBUG logs here.

Hi,

This issue has occurred again, so here I’m attaching the full DEBUG logs
full_debug_logs.txt (6.1 KB)

Here is my .gitlab-ci.yml for reference:

sonarqube-check:
  image: 
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
    GIT_DEPTH: "0"
  script: 
    - rm -rf .sonar
    - sonar-scanner -X
  allow_failure: true
  rules:
    - if: '$CI_PIPELINE_SOURCE == "push"'
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_PIPELINE_SOURCE == "trigger"'
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      changes:
      - "**/*"
      when: always

Thanks. I think we can rule out that this has anything specifically to do with the cache, as this time it’s on another file.

06:21:20.860 DEBUG: Download https://sonar.jungleworks.com/batch/file?name=sonar-scanner-engine-shaded-9.9.1.69595-all.jar to /builds/hippo/hippo-backend/.sonar/cache/_tmp/fileCache1420644740582642099.tmp
...
Caused by: java.net.ProtocolException: unexpected end of stream

It looks like you’re serving your SonarQube server over HTTPS, which means there’s something in the middle that’s actually serving your project over HTTPS (Nginx, IIS, Httpd). What are you using, and could there be some non-standard configuration that inteferes with client connections, especially when it comes to downloading larger files (reference)?

Hi,

Thank you for the response, The maximum body size for the client was 100M, I have now updated it to 1000MB, and after the update, the analysis is working fine.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.