From aa24d0892610f1b6cbfb91b1d03c9b26f3724dc7 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Thu, 18 Jul 2019 10:12:10 -0700 Subject: [PATCH] ci: use local_memory_estimate (#7558) Signed-off-by: Lizan Zhou --- .bazelrc | 7 +------ ci/build_setup.sh | 2 +- ci/do_ci.sh | 6 ++++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.bazelrc b/.bazelrc index 771d01e27b3f..aaab93c120aa 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,12 +1,7 @@ # Envoy specific Bazel build/test options. - -# Bazel doesn't need more than 200MB of memory based on memory profiling: -# https://docs.bazel.build/versions/master/skylark/performance.html#memory-profiling -# Limiting JVM heapsize here to let it do GC more when approaching the limit to -# leave room for compiler/linker. -startup --host_jvm_args=-Xmx512m build --workspace_status_command=bazel/get_workspace_status build --experimental_remap_main_repo +build --experimental_local_memory_estimate build --host_force_python=PY2 build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a build --action_env=BAZEL_LINKOPTS=-lm:-static-libgcc diff --git a/ci/build_setup.sh b/ci/build_setup.sh index f5ae34ac5fc9..fd2a94f05a8b 100755 --- a/ci/build_setup.sh +++ b/ci/build_setup.sh @@ -58,7 +58,7 @@ fi export BAZEL_QUERY_OPTIONS="${BAZEL_OPTIONS}" export BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone \ --verbose_failures ${BAZEL_OPTIONS} --action_env=HOME --action_env=PYTHONUSERBASE \ - --jobs=${NUM_CPUS} --show_task_finish --experimental_generate_json_trace_profile \ + --local_cpu_resources=${NUM_CPUS} --show_task_finish --experimental_generate_json_trace_profile \ --test_env=HOME --test_env=PYTHONUSERBASE --cache_test_results=no --test_output=all \ ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}" diff --git a/ci/do_ci.sh b/ci/do_ci.sh index e47f66563bec..daf1c2a15e56 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -238,8 +238,10 @@ elif [[ "$CI_TARGET" == "bazel.coverage" ]]; then setup_clang_toolchain echo "bazel coverage build with tests ${TEST_TARGETS}" - # LLVM coverage is a memory hog too. - [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_cpu_resources=6" + # Reduce the amount of memory Bazel tries to use to prevent it from launching too many subprocesses. + # This should prevent the system from running out of memory and killing tasks. See discussion on + # https://github.com/envoyproxy/envoy/pull/5611. + [ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_BUILD_OPTIONS} --local_ram_resources=12288" test/run_envoy_bazel_coverage.sh ${TEST_TARGETS} collect_build_profile coverage