Sonarcloud-scan:4.1.0 failing with OOM when executed from Bitbucket Pipeline

I checked the similar issues reported/resolved in this community. But this don’t help me. Still seeing “Container ‘docker’ exceeded memory limit.”

My Bitbucket Pipeline is as follows.

definitions:
  services:
    docker:
      memory: 15000
  steps:
    - step: &sonarQube-poc
        name: Sonarqube poc
        size: 4x
        max-time: 60
        services:
          - docker
        oidc: true
        clone:
          depth: full
        script:
          - pipe: sonarsource/sonarcloud-scan:4.1.0
            variables:
              DEBUG: 'true'
              SONAR_HOST_URL: "https://sonarqube.us"
              SONAR_SCANNER_OPTS: "-Xmx13000m"

pipelineLog-{45dbe1b1-44d9-4412-860e-34ed67007e23}.txt (84.7 KB). This is the log file from pipeline

Hope I can get a resolution on this.

Thanks,

Rabi

Hey there.

Can you try making this SONAR_SCANNER_JAVA_OPTS?

Hi Colin,

Thanks for responding. I still see the issue with SONAR_SCANNER_JAVA_OPTS.

See the log attached.

pipelineLog-{ac5a7005-a1a7-46c1-b47c-17514aff5de9}.txt (112.8 KB)

Thanks.

In that case, I’m going to escalate this to the team responsible for pythonbugs, since that seems to be where it’s crashing. Hold tight!

Hello,

I don’t think the issue is specifically related to pythonbugs. I don’t think the scanner is using the docker’s RAM.

I am not an expert in bitbucket, but looking at the documentation you sent, the 16GB of the size x4 is split between the docker container (15GB) and the build container (1GB).

But as the scanner is executer on the build container (as its not a docker command) the allocated RAM far exceed the available one.

I suggest you slightly lower the ran of the docker service to 13GB and allocate 2GB to the scanner engine instead of 11GB.

definitions:
  services:
    docker:
      memory: 13000
  steps:
    - step: &sonarQube-poc
        name: Sonarqube poc
        size: 4x
        max-time: 60
        services:
          - docker
        oidc: true
        clone:
          depth: full
        script:
          - pipe: sonarsource/sonarcloud-scan:4.1.0
            variables:
              DEBUG: 'true'
              SONAR_HOST_URL: "https://sonarqube.us"
              SONAR_SCANNER_OPTS: "-Xm2000m"

I hope this helps,
Gabriel