✖ SonarCloud analysis failed

Hi there,

Everytime, I run bitbucket pipeline I got this error in sonarcloud.

INFO: Sensor JavaXmlSensor [java] (done) | time=37992ms
INFO: Sensor HTML [web]
/usr/bin/run-scanner.sh: line 24:    11 Killed                  sonar-scanner "${ALL_ARGS[@]}" 2>&1
    12 Done                    | tee "${SCANNER_REPORT}"
 ✖ SonarCloud analysis failed.

my bitbucket pipeline

clone:
depth: full              # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
services:
docker:
  memory: 2048
 steps:
- step: &build-test-sonarcloud
    size: 2x
    name: Build, test and analyze on SonarCloud
    caches:
      - sonar
    script:
      - pipe: sonarsource/sonarcloud-scan:1.2.1
 - step: &check-quality-gate-sonarcloud
    size: 2x
    name: Check the Quality Gate on SonarCloud
    script:
      - pipe: sonarsource/sonarcloud-quality-gate:0.1.4

     pipelines:
      pull-requests:
     '**':
  - step: *build-test-sonarcloud
    size: 2x
  - step: *check-quality-gate-sonarcloud
    size: 2x

I am new to this forum, how can I attach bitbucket pipeline log.

    Cloning into '/opt/atlassian/pipelines/agent/build'...

+ git reset --hard 6a3e205da705
HEAD is now at 6a3e205d decrease memory

+ git config user.name bitbucket-pipelines

+ git config user.email commits-noreply@bitbucket.org

+ git config push.default current

+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/

+ git remote set-url origin http://bitbucket.org/$BITBUCKET_REPO_FULL_NAME

+ git reflog expire --expire=all --all

+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude

+ CONFLICT_EXIT_CODE=3

+ git merge 83cb38120c7a --no-edit || exit $CONFLICT_EXIT_CODE
Merge made by the 'recursive' strategy.
 .../Mage/Contacts/controllers/IndexController.php   | 21 +--------------------
 .../local/Collinsharper/Chinventorym/etc/config.xml | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 30 deletions(-)

+ chmod 777 $BUILD_DIR

Cache "sonar": Downloading
Cache "sonar": Not found

Images used:
    build : docker.io/atlassian/default-image@sha256:689e2c63e20a48e0a4d31156adcf32b4474dc32b50ab05abe3682b39fb9767a8
+ docker container run \
   --volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \
   --volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \
   --volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \
   --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \
   --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan \
   --workdir=$(pwd) \
   --label=org.bitbucket.pipelines.system=true \
   --env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \
   --env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \
   --env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \
   --env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \
   --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \
   --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \
   --env=BITBUCKET_PR_DESTINATION_COMMIT="$BITBUCKET_PR_DESTINATION_COMMIT" \
   --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \
   --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \
   --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \
   --env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \
   --env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \
   --env=CI="$CI" \
   --env=BITBUCKET_PR_ID="$BITBUCKET_PR_ID" \
   --env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \
   --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \
   --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \
   --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \
   --env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \
   --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \
   --env=BITBUCKET_PR_DESTINATION_BRANCH="$BITBUCKET_PR_DESTINATION_BRANCH" \
   --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \
   --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \
   --env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \
   --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \
   --env=DOCKER_HOST="tcp://host.docker.internal:2375" \
   --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
   --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan" \
   --env=SONAR_TOKEN="${SONAR_TOKEN}" \
   --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
   sonarsource/sonarcloud-scan:1.2.1
Unable to find image 'sonarsource/sonarcloud-scan:1.2.1' locally
1.2.1: Pulling from sonarsource/sonarcloud-scan
27833a3ba0a5: Pulling fs layer
16d944e3d00d: Pulling fs layer
6aaf465b8930: Pulling fs layer
0684138f4cb6: Pulling fs layer
67c4e741e688: Pulling fs layer
783178df3a0c: Pulling fs layer
0b76c14080f1: Pulling fs layer
bf36e4ed36b8: Pulling fs layer
471f55e1f2b3: Pulling fs layer
71259b000269: Pulling fs layer
aa8c7fc6fdc0: Pulling fs layer
0684138f4cb6: Waiting
0b76c14080f1: Waiting
bf36e4ed36b8: Waiting
471f55e1f2b3: Waiting
71259b000269: Waiting
aa8c7fc6fdc0: Waiting
783178df3a0c: Waiting
67c4e741e688: Waiting
16d944e3d00d: Verifying Checksum
16d944e3d00d: Download complete
6aaf465b8930: Verifying Checksum
6aaf465b8930: Download complete
0684138f4cb6: Verifying Checksum
0684138f4cb6: Download complete
67c4e741e688: Verifying Checksum
67c4e741e688: Download complete
27833a3ba0a5: Verifying Checksum
27833a3ba0a5: Download complete
bf36e4ed36b8: Verifying Checksum
bf36e4ed36b8: Download complete
0b76c14080f1: Verifying Checksum
0b76c14080f1: Download complete
71259b000269: Download complete
aa8c7fc6fdc0: Verifying Checksum
aa8c7fc6fdc0: Download complete
27833a3ba0a5: Pull complete
471f55e1f2b3: Verifying Checksum
471f55e1f2b3: Download complete
16d944e3d00d: Pull complete
6aaf465b8930: Pull complete
0684138f4cb6: Pull complete
783178df3a0c: Verifying Checksum
783178df3a0c: Download complete
67c4e741e688: Pull complete
783178df3a0c: Pull complete
0b76c14080f1: Pull complete
bf36e4ed36b8: Pull complete
471f55e1f2b3: Pull complete
71259b000269: Pull complete
aa8c7fc6fdc0: Pull complete
Digest: sha256:214dffb67340385ff0d251868f71a72f18e2fb92822b7d770ed50068c2a641d2
Status: Downloaded newer image for sonarsource/sonarcloud-scan:1.2.1
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.4.0.2170
INFO: Java 11.0.2 Oracle Corporation (64-bit)
INFO: Linux 5.4.92-flatcar amd64
INFO: Bitbucket Cloud Pipelines detected
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.5.0
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=614ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=150ms
INFO: Load/download plugins (done) | time=31319ms
INFO: Loaded core extensions: developer-scanner
INFO: JavaScript/TypeScript frontend is enabled
INFO: Found an active CI vendor: 'Bitbucket Pipelines'
INFO: Detected project key 'silvergoldbull_magento' from 'Bitbucket Cloud Pipelines'
INFO: Detected organization key 'silvergoldbull' from 'Bitbucket Cloud Pipelines'
INFO: Load project settings for component key: 'silvergoldbull_magento'
INFO: Load project settings for component key: 'silvergoldbull_magento' (done) | time=111ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: silvergoldbull_magento
INFO: Base dir: /opt/atlassian/pipelines/agent/build
INFO: Working dir: /opt/atlassian/pipelines/agent/build/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=101ms
INFO: Check ALM binding of project 'silvergoldbull_magento'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project 'silvergoldbull_magento' (done) | time=103ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=105ms
INFO: Load branch configuration
INFO: Detected analysis for pull request '330' targeting 'master'
INFO: Auto-configuring pull request 330
INFO: Load branch configuration (done) | time=686ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=146ms
INFO: Load active rules
INFO: Load active rules (done) | time=3225ms
INFO: Organization key: silvergoldbull
INFO: Pull request 330 for merge into master from AGILE-2305
INFO: SCM collecting changed files in the branch
INFO: SCM collecting changed files in the branch (done) | time=240ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 7445 files indexed...  (last one was app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php)
WARN: Invalid character encountered in file /opt/atlassian/pipelines/agent/build/app/code/local/Collinsharper/Monerisinterac/controllers/IndexController.php at line 185 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh-landing/template/page/2columns-left.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh-landing/template/page/2columns-right-diamonds.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh-landing/template/page/1column.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh-landing/template/page/3columns.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh-landing/template/page/2columns-right.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh/template/page/2columns-left.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh/template/page/2columns-right-diamonds.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh/template/page/1column.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh/template/page/3columns.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.
WARN: File '/opt/atlassian/pipelines/agent/build/app/design/frontend/default/fresh/template/page/2columns-right.phtml' is ignored. It is a symbolic link targeting a file not located in project basedir.


WARN: Invalid character encountered in file /opt/atlassian/pipelines/agent/build/lib/AvaTax/classes/AvaCert2Svc/CertificateRequestStatus.class.php at line 10 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.



INFO: 22364 files indexed...  (last one was js/aitoc/aitpermissions/main.js)
WARN: Invalid character encountered in file /opt/atlassian/pipelines/agent/build/js/extjs/resources/css/ytheme-galdaka.css at line 475 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
WARN: Invalid character encountered in file /opt/atlassian/pipelines/agent/build/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js at line 170 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 23607 files indexed
INFO: 889 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for flex: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for php: Sonar way
INFO: Quality profile for plsql: Sonar way
INFO: Quality profile for py: Sonar way
INFO: Quality profile for ruby: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module silvergoldbull_magento
INFO: JavaScript/TypeScript frontend is enabled
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=106ms
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=3089ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: 16846 source files to be analyzed
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/common/css/DataTable.css, line 101, Unknown word
INFO: 2070/16846 files analyzed, current file: app/code/local/AW/Storecredit/Model/Source/System/Config/Cms/Page.php
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/js/extjs/resources/css/ytheme-magento.css, line 168, Unknown word
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/Lib/SGB/sgb.css, line 1033, Unclosed block
INFO: 4710/16846 files analyzed, current file: __Toro.php
INFO: 6918/16846 files analyzed, current file: lib/Gene/Braintree/braintree/braintree_php/tests/Braintree/CreditCardDefaults.php
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/common/css/demo_table_jui.css, line 37, Unknown word
INFO: 8735/16846 files analyzed, current file: Lib/Bootstrap/3.3.1/bootstrap-3.3.1/dist/css/bootstrap.css
INFO: 10723/16846 files analyzed, current file: app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/PathDependent.php
ERROR: Failed to parse file:///opt/atlassian/pipelines/agent/build/common/css/jquery-ui.css, line 276, Unexpected }
INFO: 12463/16846 files analyzed, current file: app/code/core/Mage/Shipping/Model/Carrier/Pickup.php
INFO: 14268/16846 files analyzed, current file: lib/Zend/Feed/Builder/Exception.php
INFO: 16040/16846 files analyzed, current file: app/code/community/Fooman/Surcharge/Model/Updates.php
INFO: 16846/16846 source files have been analyzed
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=85493ms
INFO: Sensor PL/SQL Sensor [plsql]
WARN: The Data Dictionary is not configured for PLSQL analyzer which prevents rule(s) S3641, S3921, S3618, S3651 to raise issues. See https://sonarcloud.io/documentation/analysis/languages/plsql/
INFO: 17 source files to be analyzed
INFO: 17/17 source files have been analyzed
INFO: Sensor PL/SQL Sensor [plsql] (done) | time=444ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=24ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=2ms
INFO: Sensor JavaXmlSensor [java]
INFO: 2872 source files to be analyzed
WARN: Invalid character encountered in file /opt/atlassian/pipelines/agent/build/lib/Zend/Locale/Data-orig/id.xml at line 644 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 516/2872 files analyzed, current file: app/code/local/SGB/Spree/etc/config.xml
INFO: 1288/2872 files analyzed, current file: sitemaps/sitemap-153.xml
INFO: 1913/2872 files analyzed, current file: sitemaps/sitemap-26.xml
WARN: Invalid character encountered in file /opt/atlassian/pipelines/agent/build/lib/Zend/Locale/Data/id.xml at line 644 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 2360/2872 files analyzed, current file: lib/Zend/Locale/Data/wae.xml
INFO: 2872/2872 source files have been analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=46760ms
INFO: Sensor HTML [web]
/usr/bin/run-scanner.sh: line 24:    12 Killed                  sonar-scanner "${ALL_ARGS[@]}" 2>&1
        13 Done                    | tee "${SCANNER_REPORT}"
e[31m✖ SonarCloud analysis failed.e[0m
Skipping cache upload for failed step
Searching for files matching artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/**
Artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/** matched 1 files with a total size of 38.8 KiB
Compressed files matching artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/** to 3.5 KiB in 0 seconds
Uploading artifact of 3.5 KiB
Successfully uploaded artifact in 1 seconds

Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

Hi @waleedmazhar,

Welcome to the community. We will investigate your problem and get back to you soon.

Best,
Nils

Hi Nils,

Any update?

Thanks

Hi @waleedmazhar,

From what I can see in your logs, it seems to be a larger project that is being analyzed. It may be that 2 GB of memory that you provide to your container is not enough. Have you tried to increase the memory? Does the same problem occur in the same place?

Cheers,

Hi @Nils_Werner

thank you for your reply. Yes our project is big, it is magneto. it total size is around 300mb

I am already using size: 2x in pipeline. Every time pipeline runs I got same error, it break on html, as mentioned in error message.

Any thoughts on it, how can we run it successfully.

Thanks in advance,

Hi @waleedmazhar,

With such a large project, it doesn’t seem surprising that 2GB is not enough to complete the analysis. Can you please try with increased memory? (4GB or even more)

Also, we just released a small change to the scan pipe, to print the exit code when the scanner process crashes. Please adjust your pipeline to use this new release, and let us know the exit code printed when the process is killed:

- pipe: sonarsource/sonarcloud-scan:1.2.2

This is unlikely to change anything though. Ultimately it looks like the scanner simply needs more memory to analyze such project, and if it cannot have enough, then the pipeline shoots it down.

Hi Janos,

After updating pipeline I got different error and increase memory to max that bitbucket pipelien provide e.g. 8GB

INFO: Sensor JavaScript analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/root/.sonar/cache/89a79ed6219c43720f92a0780fe73b4c/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /opt/atlassian/pipelines/agent/build/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules4598013441502352460
INFO: 1351 source files to be analyzed
INFO: 0/1351 files analyzed, current file: js/tiny_mce/utils/validate.js
INFO: 6/1351 files analyzed, current file: common/js/ZeroClipboard.js
INFO: 19/1351 files analyzed, current file: common/js/jquery-ui.js
INFO: 19/1351 files analyzed, current file: common/js/jquery-ui.js
time="2021-04-23T13:42:05Z" level=error msg="error waiting for container: unexpected EOF"

Thanks for the update.

Do you see an exit code at the end? Something like this, with some number:

:heavy_multiplication_x: SonarCloud analysis failed. (exit code = 2)

In any case, regarding the last error message (error waiting for container: unexpected EOF), it looks like this is coming from the platform, so it would be best to ask Bitbucket about it.

@janos
thank you for reply. After increasing docker memory : 7128

I am getting this error

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 54:43.526s
INFO: Final Memory: 529M/1780M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: You're not authorized to run analysis. Please contact the project administrator.
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
✖ SonarCloud analysis failed. (exit code = 2)

thanks

It seems the SONAR_TOKEN is not configured correctly. This should be set as a repository, project, or workspace variable on GitHub. You can create tokens on SonarCloud, from your user’s profile, in Security.

@janos @Nils_Werner

Thank you for your help, pipeline is working fine now for both scanning and quality gate

but today I just got this error for quality gate

Status: Downloaded newer image for sonarsource/sonarcloud-quality-gate:0.1.4
..✖ Quality Gate failed: Could not fetch quality gate status: b'{"errors":[{"msg":"Analysis with id \'None\' is not found"}]}'

This could happen when the paid plan of your organization has expired, or the number of LOC has exceeded your license limit. Can you please check? See the Administration / Billing page of your organization on SonarCloud.

@janos
thanks for your constant help.

Today I got another error

INFO: Running symbolic analysis
/usr/bin/run-scanner.sh: line 26:    10 Killed                  sonar-scanner "${ALL_ARGS[@]}" 2>&1
        11 Done                    | tee "${SCANNER_REPORT}"
✖ SonarCloud analysis failed. (exit code = 137)

It looks like the platform has killed the scanner process. It would be best to ask Bitbucket about it.

A post was split to a new topic: Unable to execute SoanrScanner analysis, SocketTimeoutException

@waleedmazhar How many files do you have in this project, approximately, and what are the languages in it? If you have a lot of files, it can be understandable that a lot of memory is required. The memory needs also depend on the languages analyzed. Based on the basic statistics about the number of files per language, I can ask the language analyzer teams to see if the memory needs look suspicious.

@jonas we have approx 38500 files and it is mostly php, few html, js and css. Most of times it fail and very fewer times it successfully run.
If it is memory issue, it should fail all times.

Do you get inconsistent outcome (success <-> out of memory) for the exact same code analyzed? That would be strange indeed.

It could be interesting to know the number of lines in the largest files analyzed. Can you please share such stats for each language analyzed? (Say, the number of lines in the top 3 php, few html, js and css.)

@janos max a file contain like is 800 while agv is 200. this is magento project.

INFO: Running symbolic analysis
/usr/bin/run-scanner.sh: line 26:    10 Killed                  sonar-scanner "${ALL_ARGS[@]}" 2>&1
        11 Done                    | tee "${SCANNER_REPORT}"
✖ SonarCloud analysis failed. (exit code = 137)
INFO: Analyzing 19381 ucfgs to detect vulnerabilities.
/usr/bin/run-scanner.sh: line 26:    11 Killed                  sonar-scanner "${ALL_ARGS[@]}" 2>&1
        12 Done                    | tee "${SCANNER_REPORT}"
✖ SonarCloud analysis failed. (exit code = 137)

Yesterday, 10 pull requests created only 2 has successful while all are failed with above mentioned message. We have plan to merge pull requests into master after we can see it pass all security checks. If this will work like that then how can we rely on it for our production system.

Thanks