-
Notifications
You must be signed in to change notification settings - Fork 547
CXX-1025 CXX-829 Move special builders to 16.04 and make the ASAN build green #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,20 +28,20 @@ variables: | |
|
|
||
| ## cdriver configure flags | ||
| cdriver_configure_flags: | ||
| linux_cdriver_configure_flags: &linux_cdriver_configure_flags --enable-ssl --enable-sasl | ||
| linux_cdriver_configure_flags: &linux_cdriver_configure_flags --enable-ssl --enable-sasl --with-gnu-ld CFLAGS=-fno-omit-frame-pointer | ||
| osx_cdriver_configure_flags: &osx_cdriver_configure_flags --enable-ssl --enable-sasl | ||
|
|
||
| ## cmake flag variables | ||
| cmake_flags: | ||
| ubuntu_cmake_flags: &ubuntu_cmake_flags -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wno-attributes -Werror -Wno-error=missing-field-initializers" | ||
| osx_cmake_flags: &osx_cmake_flags -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Wno-attributes -Werror -Wno-error=missing-field-initializers" -DBSONCXX_POLY_USE_BOOST=ON | ||
| asan_cmake_flags: &asan_cmake_flags -DCMAKE_CXX_FLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -Wall -Wextra -Wno-attributes -Werror -Wno-error=missing-field-initializers -Wno-error=maybe-uninitialized" | ||
| ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-fsanitize=undefined -g -fno-omit-frame-pointer -fsanitize-blacklist=$(pwd)/../etc/ubsan.blacklist -fno-sanitize-recover -Wall -Wextra -Wno-attributes -Werror -Wno-error=missing-field-initializers" | ||
| ubuntu_cmake_flags: &ubuntu_cmake_flags -DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -Wno-error=missing-field-initializers" | ||
| osx_cmake_flags: &osx_cmake_flags -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Wall -Wextra -Werror" -DBSONCXX_POLY_USE_BOOST=ON | ||
| asan_cmake_flags: &asan_cmake_flags -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=address -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Werror" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple of questions:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ubsan_cmake_flags: &ubsan_cmake_flags -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -fsanitize=undefined -fsanitize-blacklist=$(pwd)/../etc/ubsan.blacklist -fno-sanitize-recover=undefined -O1 -g -fno-omit-frame-pointer -Wall -Wextra -Werror" | ||
|
|
||
| ## test parameters | ||
| test_params: | ||
| asan_test_params: &asan_test_params ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5 ASAN_OPTIONS="detect_leaks=1" | ||
| ubsan_test_params: &ubsan_test_params UBSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer UBSAN_OPTIONS="print_stacktrace=1" | ||
| asan_test_params: &asan_test_params PATH="/usr/lib/llvm-3.8/bin" ASAN_OPTIONS="detect_leaks=1" | ||
| ubsan_test_params: &ubsan_test_params PATH="usr/lib/llvm-3.8/bin" UBSAN_OPTIONS="print_stacktrace=1" | ||
| valgrind_test_params: &valgrind_test_params valgrind --leak-check=full --track-origins=yes --num-callers=50 --error-exitcode=1 --error-limit=no --read-var-info=yes --suppressions=../etc/memcheck.suppressions | ||
|
|
||
|
|
||
|
|
@@ -79,7 +79,7 @@ functions: | |
| cd mongo-c-driver | ||
| git checkout 1.3.4 | ||
| rm -rf /data/tmp/c-driver-install | ||
| ./autogen.sh --prefix="/data/tmp/c-driver-install" --enable-tests=no --enable-examples=no --with-libbson=bundled --disable-extra-align ${cdriver_configure_flags} | ||
| ./autogen.sh --prefix="/data/tmp/c-driver-install" --enable-tests=no --enable-examples=no --with-libbson=bundled --disable-extra-align --enable-debug --enable-optimizations --disable-shm-counters --disable-static --disable-dependency-tracking --with-pic --disable-automatic-init-and-cleanup ${cdriver_configure_flags} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming this change is mostly to increase diagnosability of C driver issues during test failures?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly, yes. Also to make sure that we control the behavior of cleanup programmatically. And a few flags to make the C driver build smaller and leaner.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The disable-automatic-init-and-cleanup turns off mongoc's use of gcc's constructor/destructor attributes, so that cleanup happens only when we call it, not at some indeterminate time (possibly before we call it, leading to a runtime exception when we call it again). |
||
| make ${compile_concurrency} | ||
| make install | ||
|
|
||
|
|
@@ -200,8 +200,8 @@ buildvariants: | |
| tasks: | ||
| - name: compile_and_test | ||
|
|
||
| - name: ubuntu1410-debug-valgrind | ||
| display_name: "Valgrind Ubuntu 14.10 Debug" | ||
| - name: ubuntu1604-debug-valgrind | ||
| display_name: "Valgrind Ubuntu 16.04 Debug" | ||
| expansions: | ||
| build_type: "Debug" | ||
| source: *ubuntu_source | ||
|
|
@@ -212,12 +212,12 @@ buildvariants: | |
| cmake_flags: *ubuntu_cmake_flags | ||
| test_params: *valgrind_test_params | ||
| run_on: | ||
| - ubuntu1410-build | ||
| - ubuntu1604-build | ||
| tasks: | ||
| - name: compile_and_test | ||
|
|
||
| - name: ubuntu1410-debug-asan | ||
| display_name: "ASAN Ubuntu 14.10 Debug" | ||
| - name: ubuntu1604-debug-asan | ||
| display_name: "ASAN Ubuntu 16.04 Debug" | ||
| expansions: | ||
| build_type: "Debug" | ||
| source: *ubuntu_source | ||
|
|
@@ -228,12 +228,12 @@ buildvariants: | |
| cmake_flags: *asan_cmake_flags | ||
| test_params: *asan_test_params | ||
| run_on: | ||
| - ubuntu1410-build | ||
| - ubuntu1604-build | ||
| tasks: | ||
| - name: compile_and_test | ||
|
|
||
| - name: ubuntu1410-debug-ubsan | ||
| display_name: "UBSAN Ubuntu 14.10 Debug" | ||
| - name: ubuntu1604-debug-ubsan | ||
| display_name: "UBSAN Ubuntu 16.04 Debug" | ||
| expansions: | ||
| build_type: "Debug" | ||
| source: *ubuntu_source | ||
|
|
@@ -244,6 +244,6 @@ buildvariants: | |
| cmake_flags: *ubsan_cmake_flags | ||
| test_params: *ubsan_test_params | ||
| run_on: | ||
| - ubuntu1410-build | ||
| - ubuntu1604-build | ||
| tasks: | ||
| - name: compile_and_test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,10 @@ | |
|
|
||
| #include <mongocxx/config/private/prelude.hpp> | ||
|
|
||
| #if !defined(__has_feature) | ||
| #define __has_feature(x) 0 | ||
| #endif | ||
|
|
||
| namespace mongocxx { | ||
| MONGOCXX_INLINE_NAMESPACE_BEGIN | ||
|
|
||
|
|
@@ -96,7 +100,15 @@ class instance::impl { | |
| if (_user_logger) { | ||
| libmongoc::log_set_handler(null_log_handler, nullptr); | ||
| } | ||
|
|
||
| // Under ASAN, we don't want to clean up libmongoc, because it causes libraries to become | ||
| // unloaded, and then ASAN sees non-rooted allocations that it consideres leaks. These are | ||
| // also inscrutable, because the stack refers into an unloaded library, which ASAN can't | ||
| // report. Note that this only works if we have built mongoc so that it doesn't do its | ||
| // unfortunate automatic invocation of 'cleanup'. | ||
| #if !__has_feature(address_sanitizer) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious if there are any related C driver feature requests we could make, such that we would be able to get rid of this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. I think what is happening is that the cleanup routines for one of the libraries that the C driver is calling is itself dlclose'ing some other library. We aren't actually building the C driver under ASAN, either. Perhaps we should? But not in this ticket. |
||
| libmongoc::cleanup(); | ||
| #endif | ||
| } | ||
|
|
||
| const std::unique_ptr<logger> _user_logger; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify the following:
-Wno-attributes?-Wno-error=missing-field-initializers?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.