From 175870997257d6873dc962734e1e62752cf3751d Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Fri, 7 Aug 2026 01:26:34 +0700 Subject: [PATCH 1/2] partial Merge bitcoin/bitcoin#33079: ci: limit max stack size to 512 KiB 3b23f95e3463bf0ab5e293654bb362d07330ff9a ci: limit max stack size to 512 KiB (dergoegge) 2931a874776073e7967bc5081306935b8abf3fd6 ci: limit stack size to 512kb in native macOS jobs (fanquake) Partial: only the asan target and only the functional test stage. Upstream sets CI_LIMIT_STACK_SIZE in ci/test/03_test_script.sh, which Dash does not have; the equivalent point in Dash's flow is ci/dash/test_integrationtests.sh, after the build and before test_runner. Upstream also sets the variable for the arm, msan, tsan and previous_releases targets. Those are green today and unit tests are not where the job runs out of memory, so leave them alone rather than perturb a passing configuration. Upstream's 512 KiB does not work for Dash: dashd dies with SIGSEGV during test framework startup. 1024 KiB is the smallest value tested that starts cleanly (512 fails, 1024, 2048 and 4096 all pass). Taken here for its effect on memory rather than its original purpose. ASan sizes a thread's fake stack from the stack rlimit, and the threads that actually run fault theirs in, so lowering the limit cuts resident memory substantially. Peak resident set of all dashd nodes over feature_llmq_data_recovery, feature_llmq_rotation, p2p_instantsend and p2p_quorum_data at -j4: 8 MiB (default) 14335 MiB 2048 KiB 12912 MiB 1024 KiB 10657 MiB Thread count is not what drives this. The same run with -par=4 -parbls=4, which takes each node from 15 script and 23 BLS worker threads down to 3 and 3, peaked at 14375 MiB, unchanged. Idle workers never fault their stacks in. --- ci/dash/test_integrationtests.sh | 5 +++++ ci/test/00_setup_env_native_asan.sh | 1 + 2 files changed, 6 insertions(+) diff --git a/ci/dash/test_integrationtests.sh b/ci/dash/test_integrationtests.sh index d546931d7cae..4b114472693d 100755 --- a/ci/dash/test_integrationtests.sh +++ b/ci/dash/test_integrationtests.sh @@ -28,6 +28,11 @@ fi cd "build-ci/dashcore-$BUILD_TARGET" +if [ -n "${CI_LIMIT_STACK_SIZE}" ]; then + # Upstream uses 512, which segfaults dashd during test framework startup. + ulimit -s 1024 +fi + if [ "$SOCKETEVENTS" = "" ]; then # Let's switch socketevents mode to some random mode R=$((RANDOM%3)) diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh index 909c42ece182..ae27b1d24e22 100755 --- a/ci/test/00_setup_env_native_asan.sh +++ b/ci/test/00_setup_env_native_asan.sh @@ -11,6 +11,7 @@ export PACKAGES="clang-19 llvm-19 libclang-rt-19-dev python3-zmq qtbase5-dev qtt # Reuses the depends built for the linux64 target, which uses the defaults. export DEP_OPTS="" export TEST_RUNNER_EXTRA="--timeout-factor=4 -j2" # Increase timeout because sanitizers slow down +export CI_LIMIT_STACK_SIZE=1 export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --enable-crash-hooks --with-gui=qt5 --without-bdb --with-sqlite \ --with-sanitizers=address,float-divide-by-zero,integer,undefined \ From e357eb1be2a37012f73de7b60c3d78969748527d Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Sat, 22 Aug 2026 01:45:41 +0700 Subject: [PATCH 2/2] test: use 4 jobs for asan --- ci/test/00_setup_env_native_asan.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh index ae27b1d24e22..a92cbebf23cd 100755 --- a/ci/test/00_setup_env_native_asan.sh +++ b/ci/test/00_setup_env_native_asan.sh @@ -10,7 +10,7 @@ export CONTAINER_NAME=ci_native_asan export PACKAGES="clang-19 llvm-19 libclang-rt-19-dev python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev bsdmainutils libboost-dev libminiupnpc-dev libzmq3-dev libqrencode-dev" # Reuses the depends built for the linux64 target, which uses the defaults. export DEP_OPTS="" -export TEST_RUNNER_EXTRA="--timeout-factor=4 -j2" # Increase timeout because sanitizers slow down +export TEST_RUNNER_EXTRA="--timeout-factor=4 -j4" # Increase timeout because sanitizers slow down export CI_LIMIT_STACK_SIZE=1 export GOAL="install" export BITCOIN_CONFIG="--enable-zmq --enable-crash-hooks --with-gui=qt5 --without-bdb --with-sqlite \