Skip to content

Commit 575589a

Browse files
committed
Merge #19041: ci: tsan with -stdlib=libc++-10
faf62e6 ci: Remove unused workaround (MarcoFalke) fa7c850 ci: Install llvm to get llvm symbolizer (MarcoFalke) fa563ce test: Add more tsan suppressions (MarcoFalke) fa0cc02 ci: Mute depends logs completely (MarcoFalke) fa906bf test: Extend tsan suppressions for clang stdlib (MarcoFalke) fa10d85 ci: Use libc++ instead of libstdc++ for tsan (MarcoFalke) fa0d5ee ci: Set halt_on_error=1 for tsan (MarcoFalke) fa2ffe8 ci: Deduplicate DOCKER_EXEC (MarcoFalke) fac2eee cirrus: Remove no longer needed install step (MarcoFalke) Pull request description: According to the [ThreadSanitizer docs](https://clang.llvm.org/docs/ThreadSanitizer.html#current-status): > C++11 threading is supported with **llvm libc++**. For example, the thread sanitizer build is currently not checking for double lock of mutexes. Fixes (partially) bitcoin/bitcoin#19038 (comment) ACKs for top commit: practicalswift: ACK faf62e6 fanquake: ACK faf62e6 hebasto: ACK faf62e6, maybe re-organize commits to modify suppressions in a single one? Tree-SHA512: 98ce5154b4736dfb811ffdb6e6f63a7bc25fe50d3b73134404a8f3715ad53626c31f9c8132dbacf85de47b9409f1e17a4399e35f78b1da30b1577167ea2982ad
2 parents bdedfcf + faf62e6 commit 575589a

File tree

7 files changed

+37
-22
lines changed

7 files changed

+37
-22
lines changed

.cirrus.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,5 @@ task:
3030
folder: "/tmp/ccache_dir"
3131
depends_built_cache:
3232
folder: "/tmp/cirrus-ci-build/depends/built"
33-
install_script:
34-
- apt-get update
35-
- apt-get -y install git bash ccache
36-
- ccache --max-size=${CCACHE_SIZE}
3733
ci_script:
3834
- ./ci/test_run_all.sh

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
FILE_ENV="./ci/test/00_setup_env_native_qt5.sh"
113113
114114
- stage: test
115-
name: 'x86_64 Linux [GOAL: install] [bionic] [no depends, only system libs, sanitizers: thread (TSan), no wallet]'
115+
name: 'x86_64 Linux [GOAL: install] [focal] [depends, sanitizers: thread (TSan), no wallet, no gui]'
116116
# Not enough memory on travis machines, so feature_block is excluded for now
117117
env: >-
118118
TEST_RUNNER_EXTRA="--exclude feature_block"

ci/test/00_setup_env_native_tsan.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
export LC_ALL=C.UTF-8
88

99
export CONTAINER_NAME=ci_native_tsan
10-
export DOCKER_NAME_TAG=ubuntu:18.04
11-
export PACKAGES="clang-9 llvm-9 python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
12-
export NO_DEPENDS=1
10+
export DOCKER_NAME_TAG=ubuntu:20.04
11+
export PACKAGES="clang llvm libc++abi-dev libc++-dev python3-zmq"
12+
export DEP_OPTS="CC=clang CXX='clang++ -stdlib=libc++'"
1313
export GOAL="install"
14-
export BITCOIN_CONFIG="--enable-zmq --disable-wallet --with-gui=qt5 CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' --with-sanitizers=thread --disable-hardening --disable-asm CC=clang-9 CXX=clang++-9"
14+
export BITCOIN_CONFIG="--enable-zmq --disable-wallet --with-gui=no CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' --with-sanitizers=thread CC=clang CXX='clang++ -stdlib=libc++'"

ci/test/03_before_install.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
export LC_ALL=C.UTF-8
88

9-
# Add llvm-symbolizer directory to PATH. Needed to get symbolized stack traces from the sanitizers.
10-
PATH=$PATH:/usr/lib/llvm-6.0/bin/
11-
export PATH
12-
139
BEGIN_FOLD () {
1410
echo ""
1511
CURRENT_FOLD_NAME=$1

ci/test/04_install.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mkdir -p "${PREVIOUS_RELEASES_DIR}"
2424

2525
export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
2626
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
27-
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
27+
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
2828
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
2929
env | grep -E '^(BITCOIN_CONFIG|BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|DEBIAN_FRONTEND|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|PREVIOUS_RELEASES_DIR)' | tee /tmp/env
3030
if [[ $HOST = *-mingw32 ]]; then
@@ -48,16 +48,14 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
4848
--env-file /tmp/env \
4949
--name $CONTAINER_NAME \
5050
$DOCKER_NAME_TAG)
51-
52-
DOCKER_EXEC () {
53-
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
54-
}
51+
export DOCKER_CI_CMD_PREFIX="docker exec $DOCKER_ID"
5552
else
5653
echo "Running on host system without docker wrapper"
57-
DOCKER_EXEC () {
58-
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
59-
}
6054
fi
55+
56+
DOCKER_EXEC () {
57+
$DOCKER_CI_CMD_PREFIX bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
58+
}
6159
export -f DOCKER_EXEC
6260

6361
if [ -n "$DPKG_ADD_ARCH" ]; then

ci/test/05_before_script.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ if [ -z "$NO_DEPENDS" ]; then
3333
else
3434
SHELL_OPTS="CONFIG_SHELL="
3535
fi
36-
DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS
36+
# Temporary workaround for https://github.com/bitcoin/bitcoin/issues/16368
37+
python3 -c 'import time; [print(".") or time.sleep(500) for _ in range(4)]' &
38+
( DOCKER_EXEC $SHELL_OPTS make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS ) &> /dev/null
3739
fi
3840
if [ -n "$PREVIOUS_RELEASES_TO_DOWNLOAD" ]; then
3941
BEGIN_FOLD previous-versions

test/sanitizer_suppressions/tsan

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
# ThreadSanitizer suppressions
22
# ============================
33

4+
# double locks (TODO fix)
5+
mutex:g_genesis_wait_mutex
6+
mutex:Interrupt
7+
mutex:CThreadInterrupt
8+
mutex:CConnman::Interrupt
9+
mutex:CConnman::WakeMessageHandler
10+
mutex:CConnman::ThreadOpenConnections
11+
mutex:CConnman::ThreadOpenAddedConnections
12+
mutex:CConnman::SocketHandler
13+
mutex:UpdateTip
14+
mutex:PeerLogicValidation::UpdatedBlockTip
15+
# race (TODO fix)
16+
race:CConnman::WakeMessageHandler
17+
race:CConnman::ThreadMessageHandler
18+
race:fHaveGenesis
19+
race:ProcessNewBlock
20+
race:ThreadImport
21+
race:zmq::*
22+
race:bitcoin-qt
23+
# deadlock (TODO fix)
24+
deadlock:CConnman::ForNode
25+
deadlock:UpdateTip
26+
427
# WalletBatch (unidentified deadlock)
528
deadlock:WalletBatch
629

0 commit comments

Comments
 (0)