*BSD, OmniOS: `-reindex` is broken #33128

issue hebasto opened this issue on August 2, 2025
  1. hebasto commented at 3:22 PM on August 2, 2025: member

    The -reindex option is broken on both the master branch and the 29.x branch (I have not tested older release branches).

    Consider the following workflow on OpenBSD 7.7:

    $ rm -rf /home/hebasto/.bitcoin/regtest
    $ ./build/bin/bitcoind -regtest -daemon
    Bitcoin Core starting
    $ ./build/bin/bitcoin-cli -regtest createwallet $(date +%Y-%m-%d)
    $ ./build/bin/bitcoin-cli -regtest -generate 200
    $ ./build/bin/bitcoin-cli -regtest getblockcount
    200
    $ ./build/bin/bitcoin-cli -regtest stop
    Bitcoin Core stopping
    $ rm -rf /home/hebasto/.bitcoin/regtest/blocks/index
    $ ./build/bin/bitcoind -regtest -daemon
    Bitcoin Core starting
    $ tail -6 /home/hebasto/.bitcoin/regtest/debug.log
    2025-08-02T15:02:00Z : Error initializing block database.
    Please restart with -reindex or -reindex-chainstate to recover.
    2025-08-02T15:02:00Z Shutdown: In progress...
    2025-08-02T15:02:00Z scheduler thread exit
    2025-08-02T15:02:00Z Flushed fee estimates to fee_estimates.dat.
    2025-08-02T15:02:00Z Shutdown: done
    $ rm /home/hebasto/.bitcoin/regtest/debug.log
    $ ./build/bin/bitcoind -regtest -daemon -reindex
    Bitcoin Core starting
    $ ./build/bin/bitcoin-cli -regtest getblockcount
    0
    $ cat /home/hebasto/.bitcoin/regtest/debug.log                    
    
    
    
    
    
    2025-08-02T15:13:08Z Bitcoin Core version v29.99.0-75ed673193c5 (release build)
    2025-08-02T15:13:08Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
    2025-08-02T15:13:08Z Using RdSeed as an additional entropy source
    2025-08-02T15:13:08Z Using RdRand as an additional entropy source
    2025-08-02T15:13:08Z Default data directory /home/hebasto/.bitcoin
    2025-08-02T15:13:08Z Using data directory /home/hebasto/.bitcoin/regtest
    2025-08-02T15:13:08Z Config file: /home/hebasto/.bitcoin/bitcoin.conf (not found, skipping)
    2025-08-02T15:13:08Z Command-line arg: daemon=""
    2025-08-02T15:13:08Z Command-line arg: regtest=""
    2025-08-02T15:13:08Z Command-line arg: reindex=""
    2025-08-02T15:13:08Z Using at most 125 automatic connections (512 file descriptors available)
    2025-08-02T15:13:08Z scheduler thread start
    2025-08-02T15:13:08Z Binding RPC on address ::1 port 18443
    2025-08-02T15:13:08Z Binding RPC on address 127.0.0.1 port 18443
    2025-08-02T15:13:08Z Generated RPC authentication cookie /home/hebasto/.bitcoin/regtest/.cookie
    2025-08-02T15:13:08Z Permissions used for cookie: rw-------
    2025-08-02T15:13:08Z Using random cookie authentication.
    2025-08-02T15:13:08Z Starting HTTP server with 16 worker threads
    2025-08-02T15:13:08Z Using wallet directory /home/hebasto/.bitcoin/regtest/wallets
    2025-08-02T15:13:08Z init message: Verifying wallet(s)…
    2025-08-02T15:13:08Z Using /16 prefix for IP bucketing
    2025-08-02T15:13:08Z init message: Loading P2P addresses…
    2025-08-02T15:13:08Z Loaded 0 addresses from peers.dat  0ms
    2025-08-02T15:13:08Z init message: Loading banlist…
    2025-08-02T15:13:08Z SetNetworkActive: true
    2025-08-02T15:13:08Z Cache configuration:
    2025-08-02T15:13:08Z * Using 2.0 MiB for block index database
    2025-08-02T15:13:08Z * Using 8.0 MiB for chain state database
    2025-08-02T15:13:08Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
    2025-08-02T15:13:08Z Script verification uses 7 additional threads
    2025-08-02T15:13:08Z Using obfuscation key for blocksdir *.dat files (/home/hebasto/.bitcoin/regtest/blocks): '997651b2ed068218'
    2025-08-02T15:13:08Z Wiping LevelDB in /home/hebasto/.bitcoin/regtest/blocks/index
    2025-08-02T15:13:08Z Opening LevelDB in /home/hebasto/.bitcoin/regtest/blocks/index
    2025-08-02T15:13:08Z Opened LevelDB successfully
    2025-08-02T15:13:08Z Using obfuscation key for /home/hebasto/.bitcoin/regtest/blocks/index: 0000000000000000
    2025-08-02T15:13:08Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
    2025-08-02T15:13:08Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
    2025-08-02T15:13:08Z init message: Loading block index…
    2025-08-02T15:13:08Z Validating signatures for all blocks.
    2025-08-02T15:13:08Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000
    2025-08-02T15:13:08Z Initializing chainstate Chainstate [ibd] @ height -1 (null)
    2025-08-02T15:13:08Z Wiping LevelDB in /home/hebasto/.bitcoin/regtest/chainstate
    2025-08-02T15:13:08Z Opening LevelDB in /home/hebasto/.bitcoin/regtest/chainstate
    2025-08-02T15:13:08Z Opened LevelDB successfully
    2025-08-02T15:13:08Z Wrote new obfuscation key for /home/hebasto/.bitcoin/regtest/chainstate: cc8a83834d10b91a
    2025-08-02T15:13:08Z Using obfuscation key for /home/hebasto/.bitcoin/regtest/chainstate: cc8a83834d10b91a
    2025-08-02T15:13:08Z init message: Verifying blocks…
    2025-08-02T15:13:08Z Block index and chainstate loaded
    2025-08-02T15:13:08Z Setting NODE_NETWORK on non-prune mode
    2025-08-02T15:13:08Z initload thread start
    2025-08-02T15:13:08Z Reindexing block file blk00000.dat...
    2025-08-02T15:13:08Z UpdateTip: new best=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 version=0x00000001 log2_work=1.000000 tx=1 date='2011-02-02T23:16:42Z' progress=0.000002 cache=0.3MiB(0txo)
    2025-08-02T15:13:08Z block tree size = 1
    2025-08-02T15:13:08Z nBestHeight = 0
    2025-08-02T15:13:08Z mapport thread start
    2025-08-02T15:13:08Z torcontrol thread start
    2025-08-02T15:13:08Z Bound to 127.0.0.1:18445
    2025-08-02T15:13:08Z Bound to [::]:18444
    2025-08-02T15:13:08Z Bound to 0.0.0.0:18444
    2025-08-02T15:13:08Z Loaded 0 addresses from "anchors.dat"
    2025-08-02T15:13:08Z 0 block-relay-only anchors will be tried for connections.
    2025-08-02T15:13:08Z init message: Starting network threads…
    2025-08-02T15:13:08Z net thread start
    2025-08-02T15:13:08Z dnsseed thread start
    2025-08-02T15:13:08Z Loading addresses from DNS seed dummySeed.invalid.
    2025-08-02T15:13:08Z addcon thread start
    2025-08-02T15:13:08Z opencon thread start
    2025-08-02T15:13:08Z init message: Done loading
    2025-08-02T15:13:08Z msghand thread start
    2025-08-02T15:13:08Z 0 addresses found from DNS seeds
    2025-08-02T15:13:08Z dnsseed thread exit
    2025-08-02T15:13:08Z Loaded 1 blocks from external file in 38ms
    2025-08-02T15:13:08Z Reindexing finished
    2025-08-02T15:13:08Z Loading 0 mempool transactions from file...
    2025-08-02T15:13:08Z Imported mempool transactions from file: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
    2025-08-02T15:13:08Z initload thread exit
    $ ./build/bin/bitcoin-cli -regtest stop
    Bitcoin Core stopping
    

    Despite the log containing the messages "Reindexing block file blk00000.dat..." and "Reindexing finished", the getblockcount RPC returns 0.

    It appears this issue affects other operating systems as well, as noted in #32987 (review).

  2. hebasto added the label Bug on Aug 2, 2025
  3. hebasto referenced this in commit 77879a5542 on Aug 2, 2025
  4. hebasto referenced this in commit 45d9f13b3f on Aug 2, 2025
  5. hebasto referenced this in commit c06a5abd1d on Aug 2, 2025
  6. hebasto referenced this in commit b74dda5e2a on Aug 2, 2025
  7. hebasto referenced this in commit 46b651c33b on Aug 2, 2025
  8. hebasto referenced this in commit c4ddaaa14d on Aug 2, 2025
  9. hebasto commented at 8:55 PM on August 2, 2025: member

    Apparently, after the failed run:

    $ rm -rf /home/hebasto/.bitcoin/regtest/blocks/index
    $ ./build/bin/bitcoind -regtest -daemon
    Bitcoin Core starting
    $ tail -6 /home/hebasto/.bitcoin/regtest/debug.log
    2025-08-02T15:02:00Z : Error initializing block database.
    Please restart with -reindex or -reindex-chainstate to recover.
    2025-08-02T15:02:00Z Shutdown: In progress...
    2025-08-02T15:02:00Z scheduler thread exit
    2025-08-02T15:02:00Z Flushed fee estimates to fee_estimates.dat.
    2025-08-02T15:02:00Z Shutdown: done
    

    the blk00000.dat file contains only the genesis block, which is clearly incorrect behaviour.

  10. hebasto commented at 9:08 PM on August 2, 2025: member

    @theStack

    Can you confirm the bug?

  11. hebasto added the label Block storage on Aug 3, 2025
  12. mzumsande commented at 11:32 PM on August 3, 2025: contributor

    Does this mean that feature_reindex.py still succeeds, so that reindex only fails if we delete the index/ dir like in feature_reindex_init.py, but not if we just reindex without corrupting anything?!

  13. theStack commented at 12:55 AM on August 4, 2025: contributor

    @theStack

    Can you confirm the bug?

    Will test in 1-2 weeks, as I unfortunately don't have access to an OpenBSD machine right now.

  14. hebasto commented at 8:51 AM on August 4, 2025: member

    Does this mean that feature_reindex.py still succeeds, so that reindex only fails if we delete the index/ dir like in feature_reindex_init.py, but not if we just reindex without corrupting anything?!

    Correct.

  15. maflcko commented at 11:30 AM on August 4, 2025: member

    Would be nice to see a test run with additional logging added to ChainstateManager::LoadExternalBlockFile (to the continue and break statements), and a log showing the size of the blk dat file.

  16. hebasto commented at 12:07 PM on August 4, 2025: member

    ... showing the size of the blk dat file.

    You mean blkdat.GetPos()?

  17. maflcko commented at 6:08 PM on August 5, 2025: member

    ... showing the size of the blk dat file.

    You mean blkdat.GetPos()?

    A bit like commit 734737b5930df7cebab83cf0dbe5fd390143f2be

  18. hebasto commented at 11:45 AM on August 9, 2025: member

    ... showing the size of the blk dat file.

    You mean blkdat.GetPos()?

    A bit like commit 734737b

    I used this branch for additional logging.

    On OpenBSD, running ./build/bin/bitcoind -regtest -logsourcelocations -daemon -reindex logs the following:

    2025-08-09T12:33:19Z [init/common.cpp:152] [void init::LogPackageVersion()] Bitcoin Core version v29.99.0-26f02ab3d92d (release build)
    2025-08-09T12:33:19Z [kernel/context.cpp:20] [kernel::Context::Context()] Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
    2025-08-09T12:33:19Z [random.cpp:110] [void (anonymous namespace)::ReportHardwareRand()] Using RdSeed as an additional entropy source
    2025-08-09T12:33:19Z [random.cpp:113] [void (anonymous namespace)::ReportHardwareRand()] Using RdRand as an additional entropy source
    2025-08-09T12:33:19Z [init/common.cpp:120] [bool init::StartLogging(const ArgsManager &)] Default data directory /home/hebasto/.bitcoin
    2025-08-09T12:33:19Z [init/common.cpp:121] [bool init::StartLogging(const ArgsManager &)] Using data directory /home/hebasto/.bitcoin/regtest
    2025-08-09T12:33:19Z [init/common.cpp:135] [bool init::StartLogging(const ArgsManager &)] Config file: /home/hebasto/.bitcoin/bitcoin.conf (not found, skipping)
    2025-08-09T12:33:19Z [common/args.cpp:851] [void ArgsManager::logArgsPrefix(const std::string &, const std::string &, const std::map<std::string, std::vector<common::SettingsValue>> &) const] Command-line arg: daemon=""
    2025-08-09T12:33:19Z [common/args.cpp:851] [void ArgsManager::logArgsPrefix(const std::string &, const std::string &, const std::map<std::string, std::vector<common::SettingsValue>> &) const] Command-line arg: logsourcelocations=""
    2025-08-09T12:33:19Z [common/args.cpp:851] [void ArgsManager::logArgsPrefix(const std::string &, const std::string &, const std::map<std::string, std::vector<common::SettingsValue>> &) const] Command-line arg: regtest=""
    2025-08-09T12:33:19Z [common/args.cpp:851] [void ArgsManager::logArgsPrefix(const std::string &, const std::string &, const std::map<std::string, std::vector<common::SettingsValue>> &) const] Command-line arg: reindex=""
    2025-08-09T12:33:19Z [init.cpp:1369] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] Using at most 125 automatic connections (512 file descriptors available)
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] scheduler thread start
    2025-08-09T12:33:19Z [httpserver.cpp:394] [bool HTTPBindAddresses(struct evhttp *)] Binding RPC on address ::1 port 18443
    2025-08-09T12:33:19Z [httpserver.cpp:394] [bool HTTPBindAddresses(struct evhttp *)] Binding RPC on address 127.0.0.1 port 18443
    2025-08-09T12:33:19Z [rpc/request.cpp:140] [GenerateAuthCookieResult GenerateAuthCookie(const std::optional<fs::perms> &, std::string &, std::string &)] Generated RPC authentication cookie /home/hebasto/.bitcoin/regtest/.cookie
    2025-08-09T12:33:19Z [rpc/request.cpp:141] [GenerateAuthCookieResult GenerateAuthCookie(const std::optional<fs::perms> &, std::string &, std::string &)] Permissions used for cookie: rw-------
    2025-08-09T12:33:19Z [httprpc.cpp:265] [bool InitRPCAuthentication()] Using random cookie authentication.
    2025-08-09T12:33:19Z [httpserver.cpp:504] [void StartHTTPServer()] Starting HTTP server with 16 worker threads
    2025-08-09T12:33:19Z [wallet/load.cpp:53] [bool wallet::VerifyWallets(WalletContext &)] Using wallet directory /home/hebasto/.bitcoin/regtest/wallets
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Verifying wallet(s)…
    2025-08-09T12:33:19Z [init.cpp:1521] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] Using /16 prefix for IP bucketing
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Loading P2P addresses…
    2025-08-09T12:33:19Z [addrdb.cpp:207] [util::Result<std::unique_ptr<AddrMan>> LoadAddrman(const NetGroupManager &, const ArgsManager &)] Loaded 0 addresses from peers.dat  1ms
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Loading banlist…
    2025-08-09T12:33:19Z [net.cpp:3192] [void CConnman::SetNetworkActive(bool)] SetNetworkActive: true
    2025-08-09T12:33:19Z [init.cpp:1722] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] Cache configuration:
    2025-08-09T12:33:19Z [init.cpp:1723] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] * Using 2.0 MiB for block index database
    2025-08-09T12:33:19Z [init.cpp:1731] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] * Using 8.0 MiB for chain state database
    2025-08-09T12:33:19Z [init.cpp:1257] [ChainstateLoadResult InitAndLoadChainstate(NodeContext &, bool, const bool, const kernel::CacheSizes &, const ArgsManager &)] * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
    2025-08-09T12:33:19Z [checkqueue.h:147] [CCheckQueue<CScriptCheck, std::pair<ScriptError_t, std::string>>::CCheckQueue(unsigned int, int) [T = CScriptCheck, R = std::pair<ScriptError_t, std::string>]] Script verification uses 7 additional threads
    2025-08-09T12:33:19Z [node/blockstorage.cpp:1176] [Obfuscation node::InitBlocksdirXorKey(const BlockManager::Options &)] Using obfuscation key for blocksdir *.dat files (/home/hebasto/.bitcoin/regtest/blocks): '2ce04306dc84ec9a'
    2025-08-09T12:33:19Z [dbwrapper.cpp:231] [CDBWrapper::CDBWrapper(const DBParams &)] Wiping LevelDB in /home/hebasto/.bitcoin/regtest/blocks/index
    2025-08-09T12:33:19Z [dbwrapper.cpp:236] [CDBWrapper::CDBWrapper(const DBParams &)] Opening LevelDB in /home/hebasto/.bitcoin/regtest/blocks/index
    2025-08-09T12:33:19Z [dbwrapper.cpp:244] [CDBWrapper::CDBWrapper(const DBParams &)] Opened LevelDB successfully
    2025-08-09T12:33:19Z [dbwrapper.cpp:260] [CDBWrapper::CDBWrapper(const DBParams &)] Using obfuscation key for /home/hebasto/.bitcoin/regtest/blocks/index: 0000000000000000
    2025-08-09T12:33:19Z [script/sigcache.cpp:36] [SignatureCache::SignatureCache(const size_t)] Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
    2025-08-09T12:33:19Z [validation.cpp:2120] [ValidationCache::ValidationCache(const size_t, const size_t)] Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Loading block index…
    2025-08-09T12:33:19Z [node/chainstate.cpp:150] [ChainstateLoadResult node::LoadChainstate(ChainstateManager &, const CacheSizes &, const ChainstateLoadOptions &)] Validating signatures for all blocks.
    2025-08-09T12:33:19Z [node/chainstate.cpp:152] [ChainstateLoadResult node::LoadChainstate(ChainstateManager &, const CacheSizes &, const ChainstateLoadOptions &)] Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000
    2025-08-09T12:33:19Z [node/chainstate.cpp:87] [ChainstateLoadResult node::CompleteChainstateInitialization(ChainstateManager &, const ChainstateLoadOptions &)] Initializing chainstate Chainstate [ibd] @ height -1 (null)
    2025-08-09T12:33:19Z [dbwrapper.cpp:231] [CDBWrapper::CDBWrapper(const DBParams &)] Wiping LevelDB in /home/hebasto/.bitcoin/regtest/chainstate
    2025-08-09T12:33:19Z [dbwrapper.cpp:236] [CDBWrapper::CDBWrapper(const DBParams &)] Opening LevelDB in /home/hebasto/.bitcoin/regtest/chainstate
    2025-08-09T12:33:19Z [dbwrapper.cpp:244] [CDBWrapper::CDBWrapper(const DBParams &)] Opened LevelDB successfully
    2025-08-09T12:33:19Z [dbwrapper.cpp:258] [CDBWrapper::CDBWrapper(const DBParams &)] Wrote new obfuscation key for /home/hebasto/.bitcoin/regtest/chainstate: 715af8a1f6e7a857
    2025-08-09T12:33:19Z [dbwrapper.cpp:260] [CDBWrapper::CDBWrapper(const DBParams &)] Using obfuscation key for /home/hebasto/.bitcoin/regtest/chainstate: 715af8a1f6e7a857
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Verifying blocks…
    2025-08-09T12:33:19Z [init.cpp:1343] [ChainstateLoadResult InitAndLoadChainstate(NodeContext &, bool, const bool, const kernel::CacheSizes &, const ArgsManager &)] Block index and chainstate loaded
    2025-08-09T12:33:19Z [init.cpp:1830] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] Setting NODE_NETWORK on non-prune mode
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] initload thread start
    2025-08-09T12:33:19Z [node/blockstorage.cpp:1236] [void node::ImportBlocks(ChainstateManager &, std::span<const fs::path>)] Reindexing block file blk00000.dat...
    2025-08-09T12:33:19Z [validation.cpp:2967] [void UpdateTipLog(const ChainstateManager &, const CCoinsViewCache &, const CBlockIndex *, const std::string &, const std::string &, const std::string &)] UpdateTip: new best=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 version=0x00000001 log2_work=1.000000 tx=1 date='2011-02-02T23:16:42Z' progress=0.000002 cache=0.3MiB(0txo)
    2025-08-09T12:33:19Z [init.cpp:1940] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] block tree size = 1
    2025-08-09T12:33:19Z [init.cpp:1953] [bool AppInitMain(NodeContext &, interfaces::BlockAndHeaderTipInfo *)] nBestHeight = 0
    2025-08-09T12:33:19Z [validation.cpp:5173] [void ChainstateManager::LoadExternalBlockFile(AutoFile &, FlatFilePos *, std::multimap<uint256, FlatFilePos> *)] blkdat.size()=20777208
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] mapport thread start
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] torcontrol thread start
    2025-08-09T12:33:19Z [net.cpp:3165] [bool CConnman::BindListenPort(const CService &, bilingual_str &, NetPermissionFlags)] Bound to 127.0.0.1:18445
    2025-08-09T12:33:19Z [net.cpp:3165] [bool CConnman::BindListenPort(const CService &, bilingual_str &, NetPermissionFlags)] Bound to [::]:18444
    2025-08-09T12:33:19Z [net.cpp:3165] [bool CConnman::BindListenPort(const CService &, bilingual_str &, NetPermissionFlags)] Bound to 0.0.0.0:18444
    2025-08-09T12:33:19Z [addrdb.cpp:239] [std::vector<CAddress> ReadAnchors(const fs::path &)] Loaded 0 addresses from "anchors.dat"
    2025-08-09T12:33:19Z [net.cpp:3321] [bool CConnman::Start(CScheduler &, const Options &)] 0 block-relay-only anchors will be tried for connections.
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Starting network threads…
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] net thread start
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] msghand thread start
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] addcon thread start
    2025-08-09T12:33:19Z [noui.cpp:57] [void noui_InitMessage(const std::string &)] init message: Done loading
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] opencon thread start
    2025-08-09T12:33:19Z [util/thread.cpp:20] [void util::TraceThread(std::string_view, std::function<void ()>)] dnsseed thread start
    2025-08-09T12:33:19Z [net.cpp:2338] [void CConnman::ThreadDNSAddressSeed()] Loading addresses from DNS seed dummySeed.invalid.
    2025-08-09T12:33:19Z [net.cpp:2374] [void CConnman::ThreadDNSAddressSeed()] 0 addresses found from DNS seeds
    2025-08-09T12:33:19Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] dnsseed thread exit
    2025-08-09T12:33:20Z [validation.cpp:5080] [void ChainstateManager::LoadExternalBlockFile(AutoFile &, FlatFilePos *, std::multimap<uint256, FlatFilePos> *)] blkdat.size()=33554432
    2025-08-09T12:33:20Z [validation.cpp:5221] [void ChainstateManager::LoadExternalBlockFile(AutoFile &, FlatFilePos *, std::multimap<uint256, FlatFilePos> *)] Loaded 1 blocks from external file in 41ms
    2025-08-09T12:33:20Z [node/blockstorage.cpp:1246] [void node::ImportBlocks(ChainstateManager &, std::span<const fs::path>)] Reindexing finished
    2025-08-09T12:33:20Z [node/mempool_persist.cpp:77] [bool node::LoadMempool(CTxMemPool &, const fs::path &, Chainstate &, ImportMempoolOptions &&)] Loading 0 mempool transactions from file...
    2025-08-09T12:33:20Z [node/mempool_persist.cpp:149] [bool node::LoadMempool(CTxMemPool &, const fs::path &, Chainstate &, ImportMempoolOptions &&)] Imported mempool transactions from file: 0 succeeded, 0 failed, 0 expired, 0 already there, 0 waiting for initial broadcast
    2025-08-09T12:33:20Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] initload thread exit
    2025-08-09T12:33:36Z [torcontrol.cpp:709] [void InterruptTorControl()] tor: Thread interrupt
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] torcontrol thread exit
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] mapport thread exit
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] opencon thread exit
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] addcon thread exit
    2025-08-09T12:33:36Z [init.cpp:287] [void Shutdown(NodeContext &)] Shutdown in progress...
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] net thread exit
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] msghand thread exit
    2025-08-09T12:33:36Z [logging/timer.h:56] [void BCLog::Timer<std::chrono::duration<long long>>::Log(const std::string &) [TimeType = std::chrono::duration<long long>]] DumpAnchors: Flush 0 outbound block-relay-only peer addresses to anchors.dat started
    2025-08-09T12:33:36Z [logging/timer.h:56] [void BCLog::Timer<std::chrono::duration<long long>>::Log(const std::string &) [TimeType = std::chrono::duration<long long>]] DumpAnchors: Flush 0 outbound block-relay-only peer addresses to anchors.dat completed (0.00s)
    2025-08-09T12:33:36Z [util/thread.cpp:22] [void util::TraceThread(std::string_view, std::function<void ()>)] scheduler thread exit
    2025-08-09T12:33:36Z [node/mempool_persist.cpp:195] [bool node::DumpMempool(const CTxMemPool &, const fs::path &, FopenFn, bool)] Writing 0 mempool transactions to file...
    2025-08-09T12:33:36Z [node/mempool_persist.cpp:205] [bool node::DumpMempool(const CTxMemPool &, const fs::path &, FopenFn, bool)] Writing 0 unbroadcast transactions to file.
    2025-08-09T12:33:36Z [node/mempool_persist.cpp:224] [bool node::DumpMempool(const CTxMemPool &, const fs::path &, FopenFn, bool)] Dumped mempool: 0.000s to copy, 0.001s to dump, 27 bytes dumped to file
    2025-08-09T12:33:36Z [policy/fees.cpp:974] [void CBlockPolicyEstimator::FlushFeeEstimates()] Flushed fee estimates to fee_estimates.dat.
    2025-08-09T12:33:36Z [init.cpp:398] [void Shutdown(NodeContext &)] Shutdown done
    

    There is not much difference compared with a run on Ubuntu, except that the line [validation.cpp:5173] [void ChainstateManager::LoadExternalBlockFile(AutoFile &, FlatFilePos *, std::multimap<uint256, FlatFilePos> *)] blkdat.size()=20777208 appears only once in the log.

  19. luke-jr commented at 12:22 AM on August 20, 2025: member

    The root issue here appears to be that CompleteChainstateInitialization calls LoadGenesisBlock before the chainstate is detected as corrupt, which then clobbers blk00000.dat via AllocateFileRange as it (re-)writes the unindexed genesis block to disk.

  20. maflcko commented at 12:34 PM on August 20, 2025: member

    Diff to reproduce on Linux:

    diff --git a/src/util/fs_helpers.cpp b/src/util/fs_helpers.cpp
    index be7f1ee5a2..ada3280dbc 100644
    --- a/src/util/fs_helpers.cpp
    +++ b/src/util/fs_helpers.cpp
    @@ -200,7 +200,7 @@ void AllocateFileRange(FILE* file, unsigned int offset, unsigned int length)
         }
         ftruncate(fileno(file), static_cast<off_t>(offset) + length);
     #else
    -#if defined(HAVE_POSIX_FALLOCATE)
    +#if 0
         // Version using posix_fallocate
         off_t nEndPos = (off_t)offset + length;
         if (0 == posix_fallocate(fileno(file), 0, nEndPos)) return;
    

    Then, ./bld-cmake/test/functional/feature_reindex_init.py gives AssertionError: not(0 == 200)

  21. hebasto commented at 8:20 PM on December 18, 2025: member

    It seems FreeBSD 15.0 is also affected.

    cc @vasild

  22. vasild commented at 12:54 PM on December 19, 2025: contributor

    FreeBSD 15.0

    Also FreeBSD 14.x

  23. hebasto renamed this:
    OpenBSD, NetBSD: `-reindex` is broken
    *BSD, OmniOS: `-reindex` is broken
    on Dec 29, 2025

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-04-24 21:12 UTC

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