-
Notifications
You must be signed in to change notification settings - Fork 37.7k
build: disable boost multi index safe mode in debug mode #27724
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
build: disable boost multi index safe mode in debug mode #27724
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Somewhat related: #27353. |
The approach taken here was influenced by discussion in #24709 (comment) I've been unable to instigate the congested behaviour on two nodes overnight, one with default mempool and one with 500MB mempool, but hopefully will manage to do so shortly and will reply here if so. In any case, it seems overkill to enable these safe mode checks in debug builds (which are often tested on mainnet), and a more sensible approach to limit to CI tasks where performance is less critical. |
Concept NACK - I don't think adding configure flags for specific Boost defines is a good approach. Will follow up in the other threads. |
OK. Looking forward to your thoughts, as I don't know how the same effect could be achieved in any neater or more maintainable way. One alternative could be to manually append to the CI CPP flags, if that's all we wanted. |
Or just a configure setting to append CPP flags to the existing ones, instead of replacing the default ones? Concept ACK |
There's no need for a new setting. Just use |
dc606c3
to
26ec68a
Compare
configure.ac
Outdated
@@ -1491,7 +1491,7 @@ if test "$use_boost" = "yes"; then | |||
AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR], | |||
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])]) | |||
|
|||
if test "$enable_debug" = "yes" || test "$enable_fuzz" = "yes"; then | |||
if test "$enable_fuzz" = "yes"; then | |||
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE" |
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.
I wonder if this should be moved to the debug fuzz task to avoid only fuzzing a debug version of boost in all fuzz configs?
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.
I like that. If anything it makes more sense to me to fuzz the non debug version...
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.
ideally both are fuzzed :)
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.
Right.
Do you think it's best to add to 00_setup_env_native_fuzz.sh ?
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.
Oh, I meant 00_setup_env_native_fuzz_debug.sh
, but I see that this is maintained elsewhere. Maybe it can be added to just fuzz_msan, or just no fuzz task at all in this repo?
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.
lgtm, but the description needs to be adjusted?
configure.ac
Outdated
@@ -1491,7 +1491,7 @@ if test "$use_boost" = "yes"; then | |||
AX_CHECK_PREPROC_FLAG([-DBOOST_NO_CXX98_FUNCTION_BASE], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_NO_CXX98_FUNCTION_BASE"], [], [$CXXFLAG_WERROR], | |||
[AC_LANG_PROGRAM([[#include <boost/config.hpp>]])]) | |||
|
|||
if test "$enable_debug" = "yes" || test "$enable_fuzz" = "yes"; then | |||
if test "$enable_fuzz" = "yes"; then | |||
BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE" |
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.
ideally both are fuzzed :)
26ec68a
to
19db479
Compare
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.
can squash to avoid touching the same line twice?
Disable boost multi index safe mode by default when configuring with --enable-debug. This option can cause transactions to take a long time to be accepted into the mempool under certain conditions; iterator destruction takes O(n) time vs O(1) as they are stored in a singly linked list. See 27586 for more information. Re-enable it on the CI builds which previously had it enabled. Re-enable it on the msan fuzz target so that we have fuzz tasks testing with it enabeld and disabled in this repo.
Now squashed :) |
19db479
to
59c8944
Compare
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.
ACK 59c8944
UPD. See #27724 (comment)
@@ -17,7 +17,7 @@ export PACKAGES="clang-16 llvm-16 libclang-rt-16-dev cmake" | |||
# BDB generates false-positives and will be removed in future | |||
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" | |||
export GOAL="install" | |||
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory --disable-hardening --with-asm=no CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" | |||
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory --disable-hardening --with-asm=no CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'" |
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.
nit: Could split the long line?
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.
Sure, will do if I touch again :)
I did think about it at the time, but some CI tasks seem to be split on ~100 chars, and some just have long lines. So I just left this one as "long" (and made it longer).
Retracting my ACK, as |
Seems unrelated, as this is failing on master. I agree it should be fixed, but I don't see why something unrelated should be holding back this pull. |
Perhaps I can drop the fuzz CPPFLAGS (introduced in this pull) for now, so that nothing is broken after this commit? diff --git a/ci/test/00_setup_env_native_fuzz_with_msan.sh b/ci/test/00_setup_env_native_fuzz_with_msan.sh
index dd694f818c..35a0de8034 100755
--- a/ci/test/00_setup_env_native_fuzz_with_msan.sh
+++ b/ci/test/00_setup_env_native_fuzz_with_msan.sh
@@ -17,7 +17,7 @@ export PACKAGES="clang-16 llvm-16 libclang-rt-16-dev cmake"
# BDB generates false-positives and will be removed in future
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
export GOAL="install"
-export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory --disable-hardening --with-asm=no CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
+export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,memory --disable-hardening --with-asm=no CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
export USE_MEMORY_SANITIZER="true"
export RUN_UNIT_TESTS="false"
export RUN_FUNCTIONAL_TESTS="false"
FWIW I do see the same (I guess) locally. At least I see failure during configure: configure: exit 1
+ false |
Again, this is unrelated, because the issue happens in |
Should be fixed in #27737. |
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.
ACK 59c8944
Disable boost multi index safe mode by default when configuring with --enable-debug. This option can cause transactions to take a long time to be accepted into the mempool under certain conditions; iterator destruction takes O(n) time vs O(1) as they are stored in a singly linked list. See 27586 for more information. Re-enable it on the CI builds which previously had it enabled. Re-enable it on the msan fuzz target so that we have fuzz tasks testing with it enabeld and disabled in this repo. Github-Pull: bitcoin#27724 Rebased-From: 59c8944
Backported to 25.x in #27775. |
9dc5848 build: disable boost multi index safe mode (willcl-ark) Pull request description: Backports #27724 to `25.x`. ACKs for top commit: stickies-v: ACK 9dc5848 Tree-SHA512: 5f156424bbd86caac6ace933b807cd62a21067bcfa7f572d6efeff2622ba0b15401038a3b06fe00d84cf62b5d9b8a9e101650d145683a21fa890c18a9c2bd4b6
This change encompasses: - bitcoin#24558 - bitcoin#27724
This change encompasses: - bitcoin#24558 - bitcoin#27724
This change encompasses: - bitcoin#24558 - bitcoin#27724
This change encompasses: - bitcoin#24558 - bitcoin#27724
Fixes #27586
Disable boost multi index safe mode by default when configuring with
--enable-debug.
This option can cause transactions to take a long time to be accepted
into the mempool under certain conditions; iterator destruction takes
O(n) time vs O(1) as they are stored in a singly linked list. See
27586 and the boost docs for more information.
Re-enable it on the CI builds which previously had it enabled.
Re-enable it on the msan fuzz task so that we have fuzz tasks testing
with it enabled and disabled in this repo.