Bitbucket failes due to memmory failed on self hosted agent

Template for a good new topic, formatted with Markdown:

  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: typscript
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
ERROR: Error during SonarScanner execution
java.lang.OutOfMemoryError: Java heap space

INFO: 135/771 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/components/Layout/Main.js
time="2023-10-12T13:28:26Z" level=error msg="error waiting for container: unexpected EOF"
  • Steps to reproduce
    Huge repository, a lot of codes.

CI content:

        sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
        - step: &sonarqube
              name: SonarQube
                  - sonar
                  - self.hosted
                  - linux
                  - pipe: sonarsource/sonarcloud-scan:2.0.0
                    size: 2x
                      SONAR_SCANNER_OPTS: '-Xmx3062m'
                  - pipe: sonarsource/sonarcloud-quality-gate:0.1.6

My mahcine has 16 GB of RAM and i can use all of that. I’ve tried different options like memmory for docker service but still sometimes it failes.

  • Potential workaround

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

1 Like

Hi Jakub!

Sorry for the long delay in responding.

Are you still facing the issue?

One weird thing that I see in the error you shared is that it’s analyzing 771 files, which isn’t much, and it’s failing after only 135, it seems like it’s being stuck on one file.
Could you try to re-run the analysis but ignore this file with sonar.exclusions parameter to see if you get a different result?

Finally i have it done with few options and using own self-hoster runner:

                        SONAR_SCANNER_OPTS: "-Xmx3062m"

            memory: 8192
            type: docker
            memory: 6144

I know that file is big, but in my opinion it might take more time but should not fail.

1 Like

Do you know what’s the size of the file roughly? In a number of lines of code?

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