diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5de1290359..3e99d04ff4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -253,6 +253,22 @@ add_boolean_option(SANITIZE_ADDRESS False "enable the address sanitizer (ASan)") if (SANITIZE_ADDRESS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common") + # There seems to be some incompatibility with pthread_create and the RT scheduler, which + # results in pthread_create hanging. + # + # When we switch from Ubuntu 16.04 to 18.04, we found that running with the address sanitizer, + # the pthread_create function calls were not working. The inital thought was that we were + # trying to create a thread that was not-blocking and would eventually crash the machine during + # the run. After more debugging, we found that we would never even start the thread. We narrowed + # down the first two instances of pthread_create in the gNB and NR UE to be sctp_eNB_task and + # one_thread, respectively. We found that adding sleeps, and various other pauses to the threads + # had not effect. From there, we found that if we add an abort(); prior to the thread loop, we + # do not execute that. This indicated to us that the problem is not likely to be a non-blocking + # thread, but perhaps and issue with pthread_create itself. From there we begain to research the + # issue on the web. See: https://github.com/google/sanitizers/issues/1125 + # + # Google searching indicates this appears to be a problem since at least 2018. This could be something + # wrong in the pthread library, or something subtly wrong in this CMakeLists.txt. Use Ubuntu 20.04 instead. endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index d10e44842c..5a201fcfef 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -452,6 +452,7 @@ function main() { MAKE_CMD=ninja shift;; --sanitize-address | -fsanitize=address) + grep -sq "Ubuntu 18.04" /etc/os-release && echo_error "Bug in OS with this option, see CMakeLists.txt" CMAKE_CMD="$CMAKE_CMD -DSANITIZE_ADDRESS=True" shift;; --ittiSIM)