Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-49197

Prevent build failures with --sanitize=* and icecc

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.5 Required
    • Component/s: Build
    • Labels:
      None
    • Server Development Platform
    • ALL
    • Dev Platform 2020-07-27

      Icecream as deployed in our fleet currently does not work with sanitizer blacklist files. We have a workaround in place that is supposed to prevent errors such as this:
      ```
      ccache /opt/mongodbtoolchain/v3/bin/clang++ -o build/optdebug/mongo/db/storage/flow_control_parameters_gen.dyn.o -c -Woverloaded-virtual -Werror=unused-result -Wpessimizing-move -Wredundant-move -Wno-undefined-var-template -Wno-instantiation-after-specialization -fsized-deallocation -Wunused-exception-parameter -std=c++17 -gsplit-dwarf -fno-omit-frame-pointer -fno-strict-aliasing -fasynchronous-unwind-tables -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-unused-private-field -Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare -Wno-tautological-constant-compare -Wno-tautological-unsigned-zero-compare -Wno-tautological-unsigned-enum-zero-compare -Wno-unused-const-variable -Wno-missing-braces -Wno-inconsistent-missing-override -Wno-potentially-evaluated-expression -Wno-unused-lambda-capture -Wno-exceptions -fstack-protector-strong -fsanitize=thread -fno-omit-frame-pointer -fsanitize-blacklist=etc/tsan.blacklist -fno-builtin-memcmp -Qunused-arguments -frewrite-includes -fPIC -DSAFEINT_USE_INTRINSICS=0 -DPCRE_STATIC -D_XOPEN_SOURCE=700 -D_GNU_SOURCE -DTHREAD_SANITIZER -DBOOST_THREAD_VERSION=5 -DBOOST_THREAD_USES_DATETIME -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DBOOST_ENABLE_ASSERT_DEBUG_HANDLER -DBOOST_LOG_NO_SHORTHAND_NAMES -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_WITHOUT_THREAD_ATTR -DABSL_FORCE_ALIGNED_ACCESS -DBOOST_LOG_DYN_LINK -Isrc/third_party/s2 -Isrc/third_party/variant-1.4.0/include -Isrc/third_party/SafeInt -Isrc/third_party/pcre-8.42 -Isrc/third_party/fmt/dist/include -Isrc/third_party/boost-1.70.0 -Isrc/third_party/abseil-cpp-master/abseil-cpp -Ibuild/optdebug -Isrc build/optdebug/mongo/db/storage/flow_control_parameters_gen.cpp
      clang: error: no such file or directory: 'etc/tsan.blacklist'
      clang: error: no such file or directory: 'etc/tsan.blacklist'
      ```

      However, if you have icecream enabled, those errors show up regardless of our workaround. It's apparent that the workaround is not working.

      Based on a review of the relevant code, it looks like the reason the workaround is not operating is because it's looking for sanitizer blacklist files in the command line:
      ```

      1. We can't handle sanitizer blacklist files, so disable icecc then, and just flow through
      2. icerun to prevent slamming the local system with a huge -j value.
        if any(
        f.startswith("-fsanitize-blacklist=")
        for fs in ["CCFLAGS", "CFLAGS", "CXXFLAGS"]
        for f in env[fs]
        ):
        env["ICECC"] = "$ICERUN" # We can't handle sanitizer blacklist files, so disable icecc then, and just flow through
      3. icerun to prevent slamming the local system with a huge -j value.
        if any(
        f.startswith("-fsanitize-blacklist=")
        for fs in ["CCFLAGS", "CFLAGS", "CXXFLAGS"]
        for f in env[fs]
        ):
        env["ICECC"] = "$ICERUN"
        ```

      Unfortunately, we are using a SCons builder to replace those command-line options at compile time because we have made the blacklist files a dependency so we can force a rebuild whenever the blacklist files have changed. This means the workaround never sees what it's expecting and is effectively non-operational.

      Implement a better workaround that disables remote builds when a sanitizer blacklist file is in use.

            Assignee:
            backlog-server-devplatform [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
            Reporter:
            ryan.egesdahl@mongodb.com Ryan Egesdahl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: