Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Limit Bazel to available CCI resources of 3072 MB (of 4096 max) & 2 core #8

Closed
wants to merge 1 commit into from

Conversation

gregmagolan
Copy link
Contributor

Should fix bazelbuild/bazel#3645.

Issue as far as I can tell is that Bazel was assuming the available resources were much higher than then actually were (the machine the docker container runs on has a ton of resources but CCI limits the container to 4096 MB and 2 cores). During SASS compilation especially there are a lot of gcc calls being launched in parallel which seemed to exceed the 4096 MB max most of the time and kill the build.

Add --local_resources=3072,2.0,1.0 to the bazel build command limits the build to resources to the amounts that CCI allows by default.

@alexeagle
Copy link
Contributor

Wow, nice find.

What is "CCI"? I don't find anything by googling that. I assume it's related to the kernel-level sandboxing under docker? Maybe you are close to finding the root cause of that bazel issue - it suggests under https://docs.bazel.build/versions/master/bazel-user-manual.html#flag--ram_utilization_factor that Bazel should detect the amount of RAM, it seems that detection doesn't take virtualization into account?

@gregmagolan
Copy link
Contributor Author

My shorthand for CircleCI :)

@gregmagolan
Copy link
Contributor Author

Yea. I checked the free mem in CircleCI during the build and its a huge amount. So no way for Bazel to know then limit is 4096 MB.

@alexeagle
Copy link
Contributor

There has to be some way Bazel can determine that - otherwise anyone using Bazel on Circle would need this workaround flag?

@alexeagle alexeagle closed this in a28c264 Sep 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bazel consumes too much memory and hangs in docker container
2 participants