Intermittent? issue in feature_init.py on macOS during clean interrupt test #35130

issue maflcko opened this issue on April 21, 2026
  1. maflcko commented at 1:59 PM on April 21, 2026: member

    This happens after commit fa16b275fa94f66067c94fb8d0854859df6953b8, which checks that an interrupt during init is harmless and leads to a normal shutdown.

    I guess the failure only happens on the https://github.com/maflcko/bitcoin-core-with-ci/tree/2601-nightly-qa-mutations branch (@ commit 125bc9a178cbfa42f01451c5319b5ab95472fdb6)

    The log https://github.com/maflcko/bitcoin-core-with-ci/actions/runs/24652909963/job/72079482591#step:9:11065:

     test  2026-04-20T10:14:16.279208Z TestFramework (INFO): Starting node and will terminate after line b'scheduler thread start' 
     test  2026-04-20T10:14:16.286336Z TestFramework.node0 (DEBUG): bitcoind started, waiting for RPC to come up 
     node0 2026-04-20T10:14:16.305638Z [init] [init/common.cpp:156] [LogPackageVersion] Bitcoin Core version v31.99.0-125bc9a178cb (release build) 
     node0 2026-04-20T10:14:16.305650Z [init] [init.cpp:774] [InitParameterInteraction] parameter interaction: -bind set -> setting -listen=1 
     node0 2026-04-20T10:14:16.305706Z [init] [init/common.cpp:102] [SetLoggingCategories] Log output may contain privacy-sensitive information. Be cautious when sharing logs. 
     node0 2026-04-20T10:14:16.305752Z [init] [kernel/context.cpp:20] [operator()] Using the 'arm_shani(1way;2way)' SHA256 implementation 
     node0 2026-04-20T10:14:16.418344Z [init] [init/common.cpp:124] [StartLogging] Default data directory /Users/runner/Library/Application Support/Bitcoin 
     node0 2026-04-20T10:14:16.418350Z [init] [init/common.cpp:125] [StartLogging] Using data directory /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest 
     node0 2026-04-20T10:14:16.418370Z [init] [init/common.cpp:134] [StartLogging] Config file: /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/bitcoin.conf 
     node0 2026-04-20T10:14:16.418380Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: regtest="1" 
     node0 2026-04-20T10:14:16.418388Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] bind="127.0.0.1" 
     node0 2026-04-20T10:14:16.418394Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] connect="0" 
     node0 2026-04-20T10:14:16.418400Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] discover="0" 
     node0 2026-04-20T10:14:16.418406Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] dnsseed="0" 
     node0 2026-04-20T10:14:16.418412Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] fallbackfee="0.0002" 
     node0 2026-04-20T10:14:16.418417Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] fixedseeds="0" 
     node0 2026-04-20T10:14:16.418422Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] keypool="1" 
     node0 2026-04-20T10:14:16.418428Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] listenonion="0" 
     node0 2026-04-20T10:14:16.418434Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] maxconnections="94" 
     node0 2026-04-20T10:14:16.418473Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] natpmp="0" 
     node0 2026-04-20T10:14:16.418493Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] par="2" 
     node0 2026-04-20T10:14:16.418500Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] peertimeout="999999999" 
     node0 2026-04-20T10:14:16.418506Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] port="11768" 
     node0 2026-04-20T10:14:16.418512Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] printtoconsole="0" 
     node0 2026-04-20T10:14:16.418517Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] rpcdoccheck="1" 
     node0 2026-04-20T10:14:16.418523Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] rpcport="16768" 
     node0 2026-04-20T10:14:16.418529Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] rpcservertimeout="99000" 
     node0 2026-04-20T10:14:16.418535Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] rpcthreads="2" 
     node0 2026-04-20T10:14:16.418541Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] server="1" 
     node0 2026-04-20T10:14:16.418546Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] shrinkdebugfile="0" 
     node0 2026-04-20T10:14:16.418552Z [init] [common/args.cpp:917] [logArgsPrefix] Config file arg: [regtest] unsafesqlitesync="1" 
     node0 2026-04-20T10:14:16.418558Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: blockfilterindex="1" 
     node0 2026-04-20T10:14:16.418563Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: coinstatsindex="1" 
     node0 2026-04-20T10:14:16.418570Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: datadir="/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0" 
     node0 2026-04-20T10:14:16.418576Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: debug="" 
     node0 2026-04-20T10:14:16.418583Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: debugexclude="libevent" 
     node0 2026-04-20T10:14:16.418588Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: debugexclude="leveldb" 
     node0 2026-04-20T10:14:16.418594Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: debugexclude="rand" 
     node0 2026-04-20T10:14:16.418600Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: loglevel="trace" 
     node0 2026-04-20T10:14:16.418605Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: logratelimit=false 
     node0 2026-04-20T10:14:16.418611Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: logsourcelocations="" 
     node0 2026-04-20T10:14:16.418616Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: logthreadnames="" 
     node0 2026-04-20T10:14:16.418622Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: logtimemicros="" 
     node0 2026-04-20T10:14:16.418627Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: txindex="1" 
     node0 2026-04-20T10:14:16.418631Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: txospenderindex="1" 
     node0 2026-04-20T10:14:16.418636Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: uacomment="testnode0" 
     node0 2026-04-20T10:14:16.418641Z [init] [common/args.cpp:917] [logArgsPrefix] Command-line arg: v2transport="0" 
     node0 2026-04-20T10:14:16.418648Z [init] [init.cpp:1445] [AppInitMain] Using at most 94 automatic connections (1024 file descriptors available) 
     node0 2026-04-20T10:14:16.418697Z [init] [init.cpp:1485] [AppInitMain] Log rate limiting disabled 
     node0 2026-04-20T10:14:16.421296Z [init] [httpserver.cpp:166] [InitHTTPAllowList] [http] Allowing HTTP connections from: 127.0.0.0/8 ::1/128 
     node0 2026-04-20T10:14:16.421341Z [init] [httpserver.cpp:342] [HTTPBindAddresses] Binding RPC on address ::1 port 16768 
     node0 2026-04-20T10:14:16.421924Z [init] [httpserver.cpp:342] [HTTPBindAddresses] Binding RPC on address 127.0.0.1 port 16768 
     node0 2026-04-20T10:14:16.421968Z [init] [httpserver.cpp:418] [InitHTTPServer] [http] Initialized HTTP server 
     node0 2026-04-20T10:14:16.421980Z [init] [httpserver.cpp:420] [InitHTTPServer] [http] set work queue of depth 64 
     node0 2026-04-20T10:14:16.421986Z [init] [rpc/server.cpp:275] [StartRPC] [rpc] Starting RPC 
     node0 2026-04-20T10:14:16.422000Z [init] [httprpc.cpp:341] [StartHTTPRPC] [rpc] Starting HTTP RPC server 
     node0 2026-04-20T10:14:16.422234Z [init] [rpc/request.cpp:140] [GenerateAuthCookie] Generated RPC authentication cookie /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/.cookie 
     node0 2026-04-20T10:14:16.422254Z [init] [rpc/request.cpp:141] [GenerateAuthCookie] Permissions used for cookie: rw------- 
     node0 2026-04-20T10:14:16.422263Z [init] [httprpc.cpp:273] [InitRPCAuthentication] Using random cookie authentication. 
     node0 2026-04-20T10:14:16.422279Z [init] [httpserver.cpp:690] [RegisterHTTPHandler] [http] Registering HTTP handler for / (exactmatch 1) 
     node0 2026-04-20T10:14:16.422286Z [init] [httpserver.cpp:690] [RegisterHTTPHandler] [http] Registering HTTP handler for /wallet/ (exactmatch 0) 
     node0 2026-04-20T10:14:16.422299Z [init] [httpserver.cpp:441] [StartHTTPServer] Starting HTTP server with 2 worker threads 
     node0 2026-04-20T10:14:16.422378Z [init] [wallet/load.cpp:53] [VerifyWallets] Using wallet directory /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/wallets 
     node0 2026-04-20T10:14:16.422397Z [http] [httpserver.cpp:302] [ThreadHTTP] [http] Entering http event loop 
     node0 2026-04-20T10:14:16.422420Z [init] [wallet/walletdb.cpp:69] [LogDBInfo] Using SQLite Version 3.43.2 
     node0 2026-04-20T10:14:16.422429Z [init] [noui.cpp:54] [noui_InitMessage] init message: Verifying wallet(s)โ€ฆ 
     node0 2026-04-20T10:14:16.422486Z [init] [init.cpp:1635] [AppInitMain] Using /16 prefix for IP bucketing 
     node0 2026-04-20T10:14:16.422495Z [init] [noui.cpp:54] [noui_InitMessage] init message: Loading P2P addressesโ€ฆ 
     node0 2026-04-20T10:14:16.422824Z [init] [logging/timer.h:58] [Log] [addrman] CheckAddrman: new 0, tried 0, total 0 started 
     node0 2026-04-20T10:14:16.422898Z [init] [logging/timer.h:58] [Log] [addrman] CheckAddrman: completed (0.06ms) 
     node0 2026-04-20T10:14:16.422907Z [init] [addrdb.cpp:207] [LoadAddrman] Loaded 0 addresses from peers.dat 0ms 
     node0 2026-04-20T10:14:16.423087Z [init] [noui.cpp:54] [noui_InitMessage] init message: Loading banlistโ€ฆ 
     node0 2026-04-20T10:14:16.423139Z [init] [banman.cpp:40] [LoadBanlist] [net] Loaded 0 banned node addresses/subnets 0ms 
     node0 2026-04-20T10:14:16.423153Z [init] [net.cpp:2440] [SetTryNewOutboundPeer] [net] setting try another outbound peer=false 
     node0 2026-04-20T10:14:16.423162Z [init] [net.cpp:3364] [SetNetworkActive] SetNetworkActive: true 
     node0 2026-04-20T10:14:16.424518Z [init] [policy/fees/block_policy_estimator.cpp:474] [Read] [estimatefee] Reading estimates: 237 buckets counting confirms up to 48 blocks 
     node0 2026-04-20T10:14:16.424710Z [init] [policy/fees/block_policy_estimator.cpp:474] [Read] [estimatefee] Reading estimates: 237 buckets counting confirms up to 12 blocks 
     node0 2026-04-20T10:14:16.425316Z [init] [policy/fees/block_policy_estimator.cpp:474] [Read] [estimatefee] Reading estimates: 237 buckets counting confirms up to 1008 blocks 
     node0 2026-04-20T10:14:16.425453Z [init] [init.cpp:1837] [AppInitMain] Cache configuration: 
     node0 2026-04-20T10:14:16.425460Z [init] [init.cpp:1838] [AppInitMain] * Using 2.0 MiB for block index database 
     node0 2026-04-20T10:14:16.425466Z [init] [init.cpp:1840] [AppInitMain] * Using 128.0 MiB for transaction index database 
     node0 2026-04-20T10:14:16.425471Z [init] [init.cpp:1843] [AppInitMain] * Using 112.0 MiB for transaction output spender index database 
     node0 2026-04-20T10:14:16.425477Z [init] [init.cpp:1847] [AppInitMain] * Using 98.0 MiB for basic block filter index database 
     node0 2026-04-20T10:14:16.425482Z [init] [init.cpp:1849] [AppInitMain] * Using 8.0 MiB for chain state database 
     node0 2026-04-20T10:14:16.425501Z [init] [init.cpp:1332] [InitAndLoadChainstate] * Using 676.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space) 
     node0 2026-04-20T10:14:16.425516Z [init] [checkqueue.h:147] [CCheckQueue] Script verification uses 1 additional threads 
     node0 2026-04-20T10:14:16.425618Z [init] [node/blockstorage.cpp:1226] [InitBlocksdirXorKey] Using obfuscation key for blocksdir *.dat files (/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/blocks): 'd365a3ee9d641f7d' 
     node0 2026-04-20T10:14:16.425638Z [init] [dbwrapper.cpp:237] [CDBWrapper] Opening LevelDB in /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/blocks/index 
     node0 2026-04-20T10:14:16.429389Z [init] [dbwrapper.cpp:245] [CDBWrapper] Opened LevelDB successfully 
     node0 2026-04-20T10:14:16.429407Z [init] [dbwrapper.cpp:261] [CDBWrapper] Using obfuscation key for /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/blocks/index: 0000000000000000 
     node0 2026-04-20T10:14:16.440236Z [init] [script/sigcache.cpp:36] [SignatureCache] Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements 
     node0 2026-04-20T10:14:16.450028Z [init] [validation.cpp:2035] [ValidationCache] Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements 
     node0 2026-04-20T10:14:16.450089Z [init] [noui.cpp:54] [noui_InitMessage] init message: Loading block indexโ€ฆ 
     node0 2026-04-20T10:14:16.450106Z [init] [node/chainstate.cpp:156] [LoadChainstate] Validating signatures for all blocks. 
     node0 2026-04-20T10:14:16.450121Z [init] [node/chainstate.cpp:158] [LoadChainstate] Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000 
     node0 2026-04-20T10:14:16.451107Z [init] [node/blockstorage.cpp:545] [LoadBlockIndexDB] Loading block index db: last block file = 0 
     node0 2026-04-20T10:14:16.451125Z [init] [node/blockstorage.cpp:549] [LoadBlockIndexDB] Loading block index db: last block file info: CBlockFileInfo(blocks=201, size=52350, heights=0...200, time=2011-02-02...2026-04-20) 
     node0 2026-04-20T10:14:16.451132Z [init] [node/blockstorage.cpp:560] [LoadBlockIndexDB] Checking all blk files are present... 
     node0 2026-04-20T10:14:16.451193Z [init] [node/chainstate.cpp:86] [CompleteChainstateInitialization] Initializing chainstate Chainstate [ibd] @ height -1 (null) 
     node0 2026-04-20T10:14:16.451222Z [init] [dbwrapper.cpp:237] [CDBWrapper] Opening LevelDB in /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/chainstate 
     node0 2026-04-20T10:14:16.455260Z [init] [dbwrapper.cpp:245] [CDBWrapper] Opened LevelDB successfully 
     node0 2026-04-20T10:14:16.455315Z [init] [dbwrapper.cpp:261] [CDBWrapper] Using obfuscation key for /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/chainstate: 66f65192d45f5a09 
     node0 2026-04-20T10:14:16.455373Z [init] [validation.cpp:3278] [UpdateIBDStatus] Leaving InitialBlockDownload (latching to false) 
     node0 2026-04-20T10:14:16.455398Z [init] [validation.cpp:4573] [LoadChainTip] Loaded best chain: hashBestChain=31280749f25f85ac8996fc406168e35fbc58998326a1d1b346962cb22021b666 height=200 date=2026-04-20T10:14:13Z progress=1.000000 
     node0 2026-04-20T10:14:16.455412Z [init] [noui.cpp:54] [noui_InitMessage] init message: Verifying blocksโ€ฆ 
     node0 2026-04-20T10:14:16.455419Z [init] [validation.cpp:4617] [VerifyDB] Verifying last 6 blocks at level 3 
     node0 2026-04-20T10:14:16.455426Z [init] [validation.cpp:4626] [VerifyDB] Verification progress: 0% 
     node0 2026-04-20T10:14:16.455558Z [init] [validation.cpp:4634] [VerifyDB] Verification progress: 16% 
     node0 2026-04-20T10:14:16.455634Z [init] [validation.cpp:4634] [VerifyDB] Verification progress: 33% 
     node0 2026-04-20T10:14:16.455702Z [init] [validation.cpp:4634] [VerifyDB] Verification progress: 50% 
     node0 2026-04-20T10:14:16.455770Z [init] [validation.cpp:4634] [VerifyDB] Verification progress: 66% 
     node0 2026-04-20T10:14:16.455839Z [init] [validation.cpp:4634] [VerifyDB] Verification progress: 83% 
     node0 2026-04-20T10:14:16.455906Z [init] [validation.cpp:4634] [VerifyDB] Verification progress: 99% 
     node0 2026-04-20T10:14:16.455913Z [init] [validation.cpp:4728] [VerifyDB] Verification: No coin database inconsistencies in last 6 blocks (6 transactions) 
     node0 2026-04-20T10:14:16.455919Z [init] [init.cpp:1418] [InitAndLoadChainstate] Block index and chainstate loaded 
     node0 2026-04-20T10:14:16.456079Z [init] [dbwrapper.cpp:237] [CDBWrapper] Opening LevelDB in /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/txindex 
     node0 2026-04-20T10:14:16.460912Z [init] [dbwrapper.cpp:245] [CDBWrapper] Opened LevelDB successfully 
     node0 2026-04-20T10:14:16.460938Z [init] [dbwrapper.cpp:261] [CDBWrapper] Using obfuscation key for /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/txindex: 0000000000000000 
     node0 2026-04-20T10:14:16.461080Z [init] [dbwrapper.cpp:237] [CDBWrapper] Opening LevelDB in /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/txospenderindex/db 
     node0 2026-04-20T10:14:16.464613Z [init] [dbwrapper.cpp:245] [CDBWrapper] Opened LevelDB successfully 
     node0 2026-04-20T10:14:16.464635Z [init] [dbwrapper.cpp:261] [CDBWrapper] Using obfuscation key for /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/txospenderindex/db: 0000000000000000 
     node0 2026-04-20T10:14:16.465576Z [init] [dbwrapper.cpp:237] [CDBWrapper] Opening LevelDB in /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/blockfilter/basic/db 
     node0 2026-04-20T10:14:16.469867Z [init] [dbwrapper.cpp:245] [CDBWrapper] Opened LevelDB successfully 
     node0 2026-04-20T10:14:16.469892Z [init] [dbwrapper.cpp:261] [CDBWrapper] Using obfuscation key for /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/blockfilter/basic/db: 0000000000000000 
     node0 2026-04-20T10:14:16.470108Z [init] [dbwrapper.cpp:237] [CDBWrapper] Opening LevelDB in /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/coinstatsindex/db 
     node0 2026-04-20T10:14:16.474476Z [init] [dbwrapper.cpp:245] [CDBWrapper] Opened LevelDB successfully 
     node0 2026-04-20T10:14:16.474501Z [init] [dbwrapper.cpp:261] [CDBWrapper] Using obfuscation key for /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/indexes/coinstatsindex/db: 0000000000000000 
     node0 2026-04-20T10:14:16.474521Z [init] [init.cpp:1953] [AppInitMain] Setting NODE_NETWORK in non-prune mode 
     node0 2026-04-20T10:14:16.474584Z [init] [init.cpp:2084] [AppInitMain] block tree size = 201 
     node0 2026-04-20T10:14:16.474592Z [init] [init.cpp:2097] [AppInitMain] nBestHeight = 200 
     node0 2026-04-20T10:14:16.474664Z [init] [net.cpp:3336] [BindListenPort] Bound to 127.0.0.1:11768 
     node0 2026-04-20T10:14:16.474678Z [init] [noui.cpp:54] [noui_InitMessage] init message: Starting network threadsโ€ฆ 
     node0 2026-04-20T10:14:16.474707Z [init] [net.cpp:3534] [Start] DNS seeding disabled 
     node0 2026-04-20T10:14:16.474751Z [init] [noui.cpp:54] [noui_InitMessage] init message: Done loading 
     node0 2026-04-20T10:14:17.442232Z [http_pool_0] [util/thread.cpp:21] [TraceThread] http_pool_0 thread start 
     node0 2026-04-20T10:14:17.442307Z [http_pool_1] [util/thread.cpp:21] [TraceThread] http_pool_1 thread start 
     node0 2026-04-20T10:14:17.486756Z [scheduler] [util/thread.cpp:21] [TraceThread] scheduler thread start 
     node0 2026-04-20T10:14:17.486801Z [initload] [util/thread.cpp:21] [TraceThread] initload thread start 
     test  2026-04-20T10:14:17.486870Z TestFramework (DEBUG): Terminating node after terminate line was found 
     node0 2026-04-20T10:14:17.486913Z [net] [util/thread.cpp:21] [TraceThread] net thread start 
     node0 2026-04-20T10:14:17.486980Z [initload] [node/mempool_persist.cpp:77] [LoadMempool] Loading 0 mempool transactions from file... 
     node0 2026-04-20T10:14:17.486998Z [initload] [node/mempool_persist.cpp:149] [LoadMempool] Imported mempool transactions from file: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast 
     node0 2026-04-20T10:14:17.487014Z [initload] [util/thread.cpp:23] [TraceThread] initload thread exit 
     node0 2026-04-20T10:14:17.487063Z [addcon] [util/thread.cpp:21] [TraceThread] addcon thread start 
     node0 2026-04-20T10:14:17.487095Z [msghand] [util/thread.cpp:21] [TraceThread] msghand thread start 
     node0 2026-04-20T10:14:17.569985Z [init] [httpserver.cpp:448] [InterruptHTTPServer] [http] Interrupting HTTP server 
     node0 2026-04-20T10:14:17.570066Z [init] [httprpc.cpp:357] [InterruptHTTPRPC] [rpc] Interrupting HTTP RPC server 
     node0 2026-04-20T10:14:17.570082Z [http_pool_0] [util/thread.cpp:23] [TraceThread] http_pool_0 thread exit 
     node0 2026-04-20T10:14:17.570124Z [init] [rpc/server.cpp:284] [operator()] [rpc] Interrupting RPC 
     node0 2026-04-20T10:14:17.570143Z [http_pool_1] [util/thread.cpp:23] [TraceThread] http_pool_1 thread exit 
     node0 2026-04-20T10:14:17.570173Z [init] [init.cpp:294] [Shutdown] Shutdown in progress... 
     node0 2026-04-20T10:14:17.570210Z [shutoff] [httprpc.cpp:362] [StopHTTPRPC] [rpc] Stopping HTTP RPC server 
     node0 2026-04-20T10:14:17.570232Z [shutoff] [httpserver.cpp:705] [UnregisterHTTPHandler] [http] Unregistering HTTP handler for / (exactmatch 1) 
     node0 2026-04-20T10:14:17.570256Z [shutoff] [httpserver.cpp:705] [UnregisterHTTPHandler] [http] Unregistering HTTP handler for /wallet/ (exactmatch 0) 
     node0 2026-04-20T10:14:17.570271Z [shutoff] [rpc/server.cpp:296] [operator()] [rpc] Stopping RPC 
     node0 2026-04-20T10:14:17.570289Z [addcon] [util/thread.cpp:23] [TraceThread] addcon thread exit 
     node0 2026-04-20T10:14:17.570565Z [shutoff] [rpc/server.cpp:298] [operator()] [rpc] RPC stopped. 
     node0 2026-04-20T10:14:17.570575Z [shutoff] [httpserver.cpp:459] [StopHTTPServer] [http] Stopping HTTP server 
     node0 2026-04-20T10:14:17.570581Z [shutoff] [httpserver.cpp:461] [StopHTTPServer] [http] Waiting for HTTP worker threads to exit 
     node0 2026-04-20T10:14:17.570708Z [shutoff] [httpserver.cpp:486] [StopHTTPServer] [http] Waiting for HTTP event thread to exit 
     node0 2026-04-20T10:14:17.570727Z [http] [httpserver.cpp:305] [ThreadHTTP] [http] Exited http event loop 
     node0 2026-04-20T10:14:17.570771Z [shutoff] [httpserver.cpp:491] [StopHTTPServer] [http] Stopped HTTP server 
     node0 2026-04-20T10:14:17.611802Z [net] [util/thread.cpp:23] [TraceThread] net thread exit 
     node0 2026-04-20T10:14:17.672441Z [msghand] [util/thread.cpp:23] [TraceThread] msghand thread exit 
     node0 2026-04-20T10:14:17.675615Z [shutoff] [net.cpp:2408] [DumpAddresses] [net] Flushed 0 addresses to peers.dat 2ms 
     node0 2026-04-20T10:14:17.675677Z [scheduler] [util/thread.cpp:23] [TraceThread] scheduler thread exit 
     node0 2026-04-20T10:14:17.675805Z [shutoff] [node/mempool_persist.cpp:195] [DumpMempool] Writing 0 mempool transactions to file... 
     node0 2026-04-20T10:14:17.675815Z [shutoff] [node/mempool_persist.cpp:205] [DumpMempool] Writing 0 unbroadcast transactions to file. 
     node0 2026-04-20T10:14:17.676862Z [shutoff] [node/mempool_persist.cpp:224] [DumpMempool] Dumped mempool: 0.000s to copy, 0.001s to dump, 27 bytes dumped to file 
     node0 2026-04-20T10:14:17.676879Z [shutoff] [policy/fees/block_policy_estimator.cpp:1075] [FlushUnconfirmed] [estimatefee] Recorded 0 unconfirmed txs from mempool in 0.000s 
     node0 2026-04-20T10:14:17.678499Z [shutoff] [policy/fees/block_policy_estimator.cpp:975] [FlushFeeEstimates] [estimatefee] Flushed fee estimates to /Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/test_runner/test_runner_โ‚ฟ_๐Ÿƒ_20260420_080608/feature_init_64/node0/regtest/fee_estimates.dat. 
     node0 2026-04-20T10:14:17.678528Z [shutoff] [validation.cpp:2771] [FlushStateToDisk] [coindb] Writing chainstate to disk: flush mode=FORCE_FLUSH, prune=0, large=0, critical=0, periodic=0 
     node0 2026-04-20T10:14:17.678554Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block and undo data to disk started 
     node0 2026-04-20T10:14:17.679522Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block and undo data to disk completed (0.96ms) 
     node0 2026-04-20T10:14:17.679544Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block index to disk started 
     node0 2026-04-20T10:14:17.680531Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block index to disk completed (0.98ms) 
     node0 2026-04-20T10:14:17.680575Z [shutoff] [logging/timer.h:58] [Log] [bench] BatchWrite: write coins cache to disk (0 out of 0 cached coins) started 
     node0 2026-04-20T10:14:17.680588Z [shutoff] [txdb.cpp:167] [BatchWrite] [coindb] Writing final batch of 0.00 MiB 
     node0 2026-04-20T10:14:17.680666Z [shutoff] [txdb.cpp:169] [BatchWrite] [coindb] Committed 0 changed transaction outputs (out of 0) to coin database... 
     node0 2026-04-20T10:14:17.680677Z [shutoff] [logging/timer.h:58] [Log] [bench] BatchWrite: write coins cache to disk (0 out of 0 cached coins) completed (0.09ms) 
     node0 2026-04-20T10:14:17.680703Z [shutoff] [validationinterface.cpp:266] [ChainStateFlushed] [validation] Enqueuing ChainStateFlushed: block hash=31280749f25f85ac8996fc406168e35fbc58998326a1d1b346962cb22021b666 
     node0 2026-04-20T10:14:17.680720Z [shutoff] [validationinterface.cpp:266] [operator()] [validation] ChainStateFlushed: block hash=31280749f25f85ac8996fc406168e35fbc58998326a1d1b346962cb22021b666 
     node0 2026-04-20T10:14:18.553553Z [txindex] [util/thread.cpp:21] [TraceThread] txindex thread start 
     node0 2026-04-20T10:14:18.553723Z [txindex] [index/base.cpp:213] [Sync] txindex: m_interrupt set; exiting ThreadSync 
    Error:  node0 2026-04-20T10:14:18.553779Z [txindex] [index/base.cpp:288] [Commit] [error] Failed to commit latest txindex state 
     node0 2026-04-20T10:14:18.553811Z [txindex] [util/thread.cpp:23] [TraceThread] txindex thread exit 
     node0 2026-04-20T10:14:18.619209Z [txospenderindex] [util/thread.cpp:21] [TraceThread] txospenderindex thread start 
     node0 2026-04-20T10:14:18.619360Z [txospenderindex] [index/base.cpp:213] [Sync] txospenderindex: m_interrupt set; exiting ThreadSync 
    Error:  node0 2026-04-20T10:14:18.619442Z [txospenderindex] [index/base.cpp:288] [Commit] [error] Failed to commit latest txospenderindex state 
     node0 2026-04-20T10:14:18.619518Z [txospenderindex] [util/thread.cpp:23] [TraceThread] txospenderindex thread exit 
     node0 2026-04-20T10:14:18.619627Z [coinstatsindex] [util/thread.cpp:21] [TraceThread] coinstatsindex thread start 
     node0 2026-04-20T10:14:18.619701Z [coinstatsindex] [index/base.cpp:213] [Sync] coinstatsindex: m_interrupt set; exiting ThreadSync 
    Error:  node0 2026-04-20T10:14:18.619776Z [coinstatsindex] [index/base.cpp:288] [Commit] [error] Failed to commit latest coinstatsindex state 
     node0 2026-04-20T10:14:18.619821Z [basic block filter index] [util/thread.cpp:21] [TraceThread] basic block filter index thread start 
     node0 2026-04-20T10:14:18.619907Z [basic block filter index] [index/base.cpp:213] [Sync] basic block filter index: m_interrupt set; exiting ThreadSync 
    Error:  node0 2026-04-20T10:14:18.619966Z [basic block filter index] [index/base.cpp:288] [Commit] [error] Failed to commit latest basic block filter index state 
     node0 2026-04-20T10:14:18.620023Z [basic block filter index] [util/thread.cpp:23] [TraceThread] basic block filter index thread exit 
     node0 2026-04-20T10:14:18.620063Z [coinstatsindex] [util/thread.cpp:23] [TraceThread] coinstatsindex thread exit 
     node0 2026-04-20T10:14:18.620503Z [shutoff] [validation.cpp:2771] [FlushStateToDisk] [coindb] Writing chainstate to disk: flush mode=FORCE_FLUSH, prune=0, large=0, critical=0, periodic=0 
     node0 2026-04-20T10:14:18.620632Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block and undo data to disk started 
     node0 2026-04-20T10:14:18.623670Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block and undo data to disk completed (2.99ms) 
     node0 2026-04-20T10:14:18.623759Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block index to disk started 
     node0 2026-04-20T10:14:18.626021Z [shutoff] [logging/timer.h:58] [Log] [bench] FlushStateToDisk: write block index to disk completed (2.21ms) 
     node0 2026-04-20T10:14:18.626136Z [shutoff] [logging/timer.h:58] [Log] [bench] BatchWrite: write coins cache to disk (0 out of 0 cached coins) started 
     node0 2026-04-20T10:14:18.626184Z [shutoff] [txdb.cpp:167] [BatchWrite] [coindb] Writing final batch of 0.00 MiB 
     node0 2026-04-20T10:14:18.626355Z [shutoff] [txdb.cpp:169] [BatchWrite] [coindb] Committed 0 changed transaction outputs (out of 0) to coin database... 
     node0 2026-04-20T10:14:18.626410Z [shutoff] [logging/timer.h:58] [Log] [bench] BatchWrite: write coins cache to disk (0 out of 0 cached coins) completed (0.23ms) 
     node0 2026-04-20T10:14:18.626484Z [shutoff] [validationinterface.cpp:266] [ChainStateFlushed] [validation] Enqueuing ChainStateFlushed: block hash=31280749f25f85ac8996fc406168e35fbc58998326a1d1b346962cb22021b666 
     node0 2026-04-20T10:14:18.629758Z [shutoff] [init.cpp:420] [Shutdown] Shutdown done 
     test  2026-04-20T10:14:18.633103Z TestFramework (ERROR): Unexpected exception: 
                                       Traceback (most recent call last):
                                         File "/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/test/functional/test_framework/test_framework.py", line 143, in main
                                           self.run_test()
                                           ~~~~~~~~~~~~~^^
                                         File "/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/build-aarch64-apple-darwin24.6.0/test/functional/feature_init.py", line 328, in run_test
                                           self.init_stress_test_interrupt()
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                                         File "/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/build-aarch64-apple-darwin24.6.0/test/functional/feature_init.py", line 101, in init_stress_test_interrupt
                                           sigterm_node()
                                           ~~~~~~~~~~~~^^
                                         File "/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/ci/scratch/build-aarch64-apple-darwin24.6.0/test/functional/feature_init.py", line 64, in sigterm_node
                                           assert_equal(0, node.process.wait())
                                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
                                         File "/Users/runner/work/bitcoin-core-with-ci/bitcoin-core-with-ci/repo_archive/test/functional/test_framework/util.py", line 83, in assert_equal
                                           raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
                                       AssertionError: not(0 == 1)
    

    So there are a bunch of oddities:

    • Logging the errors of the form [error] Failed to commit latest ... seems a bit wrong. I guess this may have been introduced in commit 7878f97bf15, and it could make sense to skip logging the error on a harmless init interrupt.
    • Why is the return code 1, but no stderr or otherwise any indication of why it would be 1?
    • Why can I not reproduce this locally, and why does none of the other CI tasks reproduce this?
  2. maflcko added the label macOS on Apr 21, 2026
  3. maflcko added the label CI failed on Apr 21, 2026
  4. maflcko commented at 9:35 PM on April 22, 2026: member

    Looks like the CI re-run also failed. I wonder if someone has a macOS and wants to reproduce/debug this a bit more ๐Ÿ˜…

  5. l0rinc commented at 6:43 AM on April 23, 2026: contributor

    If we inject a delay into TokenRead() it triggers the clean-interrupt shutdown race in feature_init.py deterministically and bitcoind exits with the mentioned status 1:

    diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
    --- a/src/util/tokenpipe.cpp	(revision cd7865b0ce17568945c7f72db0248489cf284787)
    +++ b/src/util/tokenpipe.cpp	(date 1776925402948)
    @@ -5,6 +5,7 @@
     #include <bitcoin-build-config.h> // IWYU pragma: keep
     
     #include <util/tokenpipe.h>
    +#include <util/time.h>
     
     #ifndef WIN32
     
    @@ -61,6 +62,7 @@
         uint8_t token;
         while (true) {
             ssize_t result = read(m_fd, &token, 1);
    +        UninterruptibleSleep(10ms);
             if (result < 0) {
                 // Failure. Check if the read was interrupted by a signal,
                 // in that case retry.
    

    Reproduction:

    rm -rfd build && cmake -B build && cmake --build build -j --target bitcoind &&
    build/test/functional/test_runner.py feature_init.py

    Logs:

    [1/4] Generating bitcoin-build-info.h
    2026-04-23T06:32:55.586201Z TestFramework (INFO): PRNG seed is: 6499944067335213791
    2026-04-23T06:32:55.641811Z TestFramework (INFO): Initializing test directory /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_ab2rgkwg
    2026-04-23T06:32:56.300830Z TestFramework (INFO): Test specifying custom pid file via -pid command line option
    2026-04-23T06:32:56.300993Z TestFramework (INFO): -> path relative to datadir (my_fancy_bitcoin_pid_file.foobar)
    2026-04-23T06:32:57.151005Z TestFramework (INFO): -> absolute path (/var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_ab2rgkwg/my_fancy_bitcoin_pid_file.foobar)
    2026-04-23T06:32:59.561254Z TestFramework (INFO): Starting node and will terminate after line b'Validating signatures for all blocks'
    2026-04-23T06:32:59.822303Z TestFramework (INFO): Starting node and will terminate after line b'scheduler thread start'
    2026-04-23T06:33:00.077565Z TestFramework (INFO): Starting node and will terminate after line b'Starting HTTP server'
    2026-04-23T06:33:00.331076Z TestFramework (INFO): Starting node and will terminate after line b'Loading P2P addresses'
    2026-04-23T06:33:00.584822Z TestFramework (INFO): Starting node and will terminate after line b'Loading banlist'
    2026-04-23T06:33:00.841139Z TestFramework (INFO): Starting node and will terminate after line b'Loading block index'
    2026-04-23T06:33:01.099758Z TestFramework (INFO): Starting node and will terminate after line b'Checking all blk files are present'
    2026-04-23T06:33:01.361723Z TestFramework (INFO): Starting node and will terminate after line b'Loaded best chain:'
    2026-04-23T06:33:01.670939Z TestFramework (INFO): Starting node and will terminate after line b'init message: Verifying blocks'
    2026-04-23T06:33:01.981436Z TestFramework (INFO): Starting node and will terminate after line b'init message: Starting network threads'
    2026-04-23T06:33:02.493213Z TestFramework (INFO): Starting node and will terminate after line b'net thread start'
    2026-04-23T06:33:03.001008Z TestFramework (ERROR): Unexpected exception:
    Traceback (most recent call last):
      File "/Users/lorinc/CLionProjects/bitcoin/test/functional/test_framework/test_framework.py", line 143, in main
        self.run_test()
        ~~~~~~~~~~~~~^^
      File "/Users/lorinc/CLionProjects/bitcoin/test/functional/feature_init.py", line 328, in run_test
        self.init_stress_test_interrupt()
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
      File "/Users/lorinc/CLionProjects/bitcoin/test/functional/feature_init.py", line 101, in init_stress_test_interrupt
        sigterm_node()
        ~~~~~~~~~~~~^^
      File "/Users/lorinc/CLionProjects/bitcoin/test/functional/feature_init.py", line 64, in sigterm_node
        assert_equal(0, node.process.wait())
        ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/lorinc/CLionProjects/bitcoin/test/functional/test_framework/util.py", line 83, in assert_equal
        raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
    AssertionError: not(0 == 1)
    2026-04-23T06:33:03.057641Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    2026-04-23T06:33:03.057755Z TestFramework (WARNING): Not cleaning up dir /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_ab2rgkwg
    2026-04-23T06:33:03.057797Z TestFramework (ERROR): Test failed. Test logging available at /var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_ab2rgkwg/test_framework.log
    2026-04-23T06:33:03.057889Z TestFramework (ERROR): 
    2026-04-23T06:33:03.057996Z TestFramework (ERROR): Hint: Call /Users/lorinc/CLionProjects/bitcoin/test/functional/combine_logs.py '/var/folders/5t/04gq0pqj5yv4t8cxw51q0s2m0000gn/T/bitcoin_func_test_ab2rgkwg' to consolidate all logs
    2026-04-23T06:33:03.058026Z TestFramework (ERROR): 
    2026-04-23T06:33:03.058052Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2026-04-23T06:33:03.058102Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2026-04-23T06:33:03.058126Z TestFramework (ERROR): 
    [node 1] Cleaning up leftover process
    [node 0] Cleaning up leftover process
    
  6. maflcko commented at 12:40 PM on April 23, 2026: member

    Ah, thanks for reproducing locally, and finding the mutation patch to trigger it. I tried this locally on Linux with some more randomness, but it still passes for me:

    diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
    index 6f701e4574..fa9c9af188 100644
    --- a/src/util/tokenpipe.cpp
    +++ b/src/util/tokenpipe.cpp
    @@ -8,2 +8,7 @@
     
    +#include <random.h>
    +#include <util/time.h>
    +static FastRandomContext g_rnd{};
    +
    +
     #ifndef WIN32
    @@ -63,2 +68,3 @@ int TokenPipeEnd::TokenRead()
             ssize_t result = read(m_fd, &token, 1);
    +        UninterruptibleSleep(1ms * g_rnd.randrange(99));
             if (result < 0) {
    

    So I guess, it must be something specific to macOs?

  7. l0rinc commented at 8:49 PM on April 23, 2026: contributor

    Unfortunately my previous reproducer was bogus: the injected UninterruptibleSleep() sits between read() and the errno check, so it can clobber errno before TokenRead() observes the EINTR.

    If I save errno immediately after read(), the reproducer stops failing. So this does not prove the original macOS CI failure.

    It may still point at a reasonable hardening patch though: preserve the syscall errno in TokenPipeEnd::{TokenRead,TokenWrite}() and preserve errno across the Unix signal handlers. That should make this path less fragile, even if it is not yet a proven fix for the original intermittent failure.

    GPT-5.5 suggested the following hardening to try:

    diff --git a/src/init.cpp b/src/init.cpp
    index c53e5ed634..7fa075ba4c 100644
    --- a/src/init.cpp
    +++ b/src/init.cpp
    @@ -429,14 +429,18 @@ void Shutdown(NodeContext& node)
     #ifndef WIN32
     static void HandleSIGTERM(int)
     {
    +    const int saved_errno{errno};
         // Return value is intentionally ignored because there is not a better way
         // of handling this failure in a signal handler.
         (void)(*Assert(g_shutdown))();
    +    errno = saved_errno;
     }
    
     static void HandleSIGHUP(int)
     {
    +    const int saved_errno{errno};
         LogInstance().m_reopen_file = true;
    +    errno = saved_errno;
     }
     #else
     static BOOL WINAPI consoleCtrlHandler(DWORD dwCtrlType)
    diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
    index 6f701e4574..3c5d55e931 100644
    --- a/src/util/tokenpipe.cpp
    +++ b/src/util/tokenpipe.cpp
    @@ -42,10 +42,11 @@ int TokenPipeEnd::TokenWrite(uint8_t token)
     {
         while (true) {
             ssize_t result = write(m_fd, &token, 1);
    +        const int write_errno{errno};
             if (result < 0) {
                 // Failure. It's possible that the write was interrupted by a signal,
                 // in that case retry.
    -            if (errno != EINTR) {
    +            if (write_errno != EINTR) {
                     return TS_ERR;
                 }
             } else if (result == 0) {
    @@ -61,10 +62,11 @@ int TokenPipeEnd::TokenRead()
         uint8_t token;
         while (true) {
             ssize_t result = read(m_fd, &token, 1);
    +        const int read_errno{errno};
             if (result < 0) {
                 // Failure. Check if the read was interrupted by a signal,
                 // in that case retry.
    -            if (errno != EINTR) {
    +            if (read_errno != EINTR) {
                     return TS_ERR;
                 }
             } else if (result == 0) {
    

    Not sure it helps, how easily can we reproduce it on CI?

  8. maflcko commented at 4:04 PM on April 24, 2026: member

    Ah thx, so it is likely UninterruptibleSleep that clobbers errno and leads to return TS_ERR. I added this bug myself. The saved_errno part of your patch could still make sense, but I haven't checked if it is really needed.

    I think I'll just go with this patch locally for now:

    diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
    index a8978f7744..c4bd968527 100644
    --- a/src/util/tokenpipe.cpp
    +++ b/src/util/tokenpipe.cpp
    @@ -64,3 +64,5 @@ int TokenPipeEnd::TokenRead()
             ssize_t result = read(m_fd, &token, 1);
    +        const int read_errno{errno};
             UninterruptibleSleep(10ms);
    +        errno=read_errno;
             if (result < 0) {
    
  9. maflcko closed this on Apr 24, 2026

Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-15 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me