Skip to content

Bazel consumes too much memory and hangs in docker container #3645

Closed

Description

@alexeagle

Description of the problem / feature request / question:

I have a sass_binary rule from https://github.com/bazelbuild/rules_sass
And build in this docker image on CircleCI
https://github.com/alexeagle/ngcontainer/blob/master/Dockerfile

Most of the time the build hangs while compiling C++, but sometimes it succeeds.

If possible, provide a minimal example to reproduce the problem:

https://circleci.com/gh/alexeagle/angular-bazel-example/1
is a (somewhat) minimal example.
Source: https://github.com/alexeagle/angular-bazel-example

Environment info

  • Operating System:
    Debian linux (jessie) (in docker)

  • Bazel version (output of bazel info release):
    Build label: 0.5.1
    Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
    Build time: Tue Jun 6 10:34:11 2017 (1496745251)
    Build timestamp: 1496745251
    Build timestamp as int: 1496745251

Have you found anything relevant by searching the web?

(e.g. StackOverflow answers,
GitHub issues,
email threads on the bazel-discuss Google group)

Anything else, information or logs or outputs that would be helpful?

(If they are large, please upload as attachment or provide link).

Activity

  1. alexeagle commented on Aug 30, 2017

    @alexeagle
    ContributorAuthor

    Confirmed this also happens on release 0.5.4

  2. alexeagle commented on Aug 30, 2017

    @alexeagle
    ContributorAuthor

    Another sample, got a different behavior, instead of hanging it fails with an error:

    ERROR: /root/.cache/bazel/_bazel_root/049ed6f058a98cba95753eee774cab7a/external/sassc/BUILD.bazel:4:1: C++ compilation of rule '@sassc//:sassc' failed (Exit 1)
    
    external/libsass/src/sass.cpp:41:1: fatal error: error writing to /tmp/ccLTBo6L.s: Cannot allocate memory
     }
     ^
    compilation terminated.
    The bug is not reproducible, so it is likely a hardware or OS problem.
    
  3. added
    P2
    on Sep 1, 2017
  4. alexeagle commented on Sep 10, 2017

    @alexeagle
    ContributorAuthor

    Hi, this prevents Angular bazel apps from using CircleCI, which is our recommendation.
    It also means the canonical demo app
    https://github.com/alexeagle/angular-bazel-example
    has a flaky build status, which looks bad.

    Can someone triage this? I might be able to fix it if I could tell what is wrong.
    /cc @davidstanke

  5. alexeagle commented on Sep 22, 2017

    @alexeagle
    ContributorAuthor

    Ping!

  6. alexeagle commented on Sep 23, 2017

    @alexeagle
    ContributorAuthor
  7. added a commit that references this issue on Sep 23, 2017
  8. changed the title [-]Bazel C++ compilation hangs in docker container[/-] [+]Bazel consumes too much memory and hangs in docker container[/+] on Sep 23, 2017
  9. djudd-stripe commented on Nov 29, 2017

    @djudd-stripe

    Underlying issues might be #3886 plus #2946?

  10. laszlocsomor commented on Jun 14, 2018

    @laszlocsomor
    Contributor

    /cc: @jhfield @ulfjack @ericfelly

    Summary: #3645 (comment)

    Who should work on this?

  11. ulfjack commented on Jun 14, 2018

    @ulfjack
    Contributor

    We have no idea what's going on there, and I don't think we can debug this without seeing jvm.out. In order to get better debug information in the future, we will also need to add code to bazel client to cat jvm.out.

  12. ulfjack commented on Jun 14, 2018

    @ulfjack
    Contributor

    This isn't the first time that not having jvm.out is preventing us from making progress.

  13. ittaiz commented on Jun 14, 2018

    @ittaiz
    Member
  14. 9 remaining items

  15. added
    P4
    on Nov 24, 2020
  16. added
    stale
    on Feb 17, 2023
  17. sgowroji commented on Feb 17, 2023

    @sgowroji
    Member

    Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen (or ping me to reopen) if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

  18. fmeum commented on Feb 17, 2023

    @fmeum
    Collaborator

    @sgowroji Not stale, has a Bazel team assignee.

  19. added
    not stale
    and removed
    stale
    on Feb 17, 2023
  20. larsrc-google commented on Apr 26, 2023

    @larsrc-google
    Contributor

    I think #16512 does fix this.

  21. fmeum commented on Apr 26, 2023

    @fmeum
    Collaborator

    @larsrc-google Please reopen, my fix only applied to CPU shares, not RAM.

  22. larsrc-google commented on Apr 28, 2023

    @larsrc-google
    Contributor

    The memory usage in general is hard to control - Bazel needs to hold your build graph in memory. The amount of parallel actions can be controlled with --jobs, e.g. --jobs=HOST_RAM*0.01, together with --local_ram_resources.

  23. removed
    not stale
    on Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P4team-Rules-CPPtype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions