During IBD, sometimes I get this crash reported by gbd:
[#0](/bitcoin-bitcoin/0/) __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[#1](/bitcoin-bitcoin/1/) 0x00007fffff0c5537 in __GI_abort () at abort.c:79
[#2](/bitcoin-bitcoin/2/) 0x00000000080949d8 in CCoinsViewErrorCatcher::GetCoin (this=<optimized out>, outpoint=..., coin=...) at coins.cpp:307
[#3](/bitcoin-bitcoin/3/) 0x00000000083b0153 in CCoinsViewCache::FetchCoin (this=0x88b26a0, outpoint=...) at coins.cpp:46
[#4](/bitcoin-bitcoin/4/) 0x00000000083b033a in CCoinsViewCache::GetCoin (this=<optimized out>, outpoint=..., coin=...) at coins.cpp:59
[#5](/bitcoin-bitcoin/5/) 0x00000000083b0153 in CCoinsViewCache::FetchCoin (this=0x7fff3338f1c0, outpoint=...) at coins.cpp:46
[#6](/bitcoin-bitcoin/6/) 0x000000000829fa5a in CCoinsViewCache::HaveCoin (outpoint=..., this=0x7fff3338f1c0) at coins.cpp:160
[#7](/bitcoin-bitcoin/7/) CCoinsViewCache::HaveInputs (tx=..., this=<optimized out>) at coins.cpp:265
[#8](/bitcoin-bitcoin/8/) CCoinsViewCache::HaveInputs (tx=..., this=0x7fff3338f1c0) at coins.cpp:261
[#9](/bitcoin-bitcoin/9/) Consensus::CheckTxInputs (tx=..., state=..., inputs=..., nSpendHeight=661434, txfee=@0x7fff3338dcd0: 0) at consensus/tx_verify.cpp:171
[#10](/bitcoin-bitcoin/10/) 0x00000000085559f0 in CChainState::ConnectBlock(CBlock const&, BlockValidationState&, CBlockIndex*, CCoinsViewCache&, bool) [clone .constprop.0] (this=this@entry=0x88acfa0, block=..., state=...,
pindex=<optimized out>, pindex@entry=0xa6f0238, view=..., fJustCheck=fJustCheck@entry=false) at validation.cpp:2186
[#11](/bitcoin-bitcoin/11/) 0x000000000827b79c in CChainState::ConnectTip (disconnectpool=..., connectTrace=<synthetic pointer>..., pblock=std::shared_ptr<const CBlock> (empty) = {...}, pindexNew=0xa6f0238, state=...,
this=0x88acfa0) at validation.cpp:2720
[#12](/bitcoin-bitcoin/12/) CChainState::ActivateBestChainStep (connectTrace=..., fInvalidFound=<optimized out>, pblock=..., pindexMostWork=<optimized out>, state=..., this=<optimized out>) at validation.cpp:2883
[#13](/bitcoin-bitcoin/13/) CChainState::ActivateBestChain (this=0x88acfa0, state=..., pblock=std::shared_ptr<const CBlock> (empty) = {...}) at validation.cpp:3010
[#14](/bitcoin-bitcoin/14/) 0x000000000818ed7a in node::ThreadImport (chainman=..., vImportFiles=..., args=..., mempool_path=...) at node/blockstorage.cpp:887
[#15](/bitcoin-bitcoin/15/) 0x00000000081199f2 in operator() (__closure=0x7fff2c000b60) at init.cpp:1575
[#16](/bitcoin-bitcoin/16/) std::__invoke_impl<void, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()>&> (__f=...) at /usr/include/c++/10/bits/invoke.h:60
[#17](/bitcoin-bitcoin/17/) std::__invoke_r<void, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()>&> (__fn=...) at /usr/include/c++/10/bits/invoke.h:110
[#18](/bitcoin-bitcoin/18/) std::_Function_handler<void(), AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...)
at /usr/include/c++/10/bits/std_function.h:291
[#19](/bitcoin-bitcoin/19/) 0x00000000084331c4 in std::function<void ()>::operator()() const (this=0x7fff3338fe50) at /usr/include/c++/10/bits/std_function.h:622
[#20](/bitcoin-bitcoin/20/) util::TraceThread(char const*, std::function<void ()>) (thread_name=<optimized out>, thread_func=...) at util/thread.cpp:19
[#21](/bitcoin-bitcoin/21/) 0x00000000081197cb in std::__invoke_impl<void, void (*)(char const*, std::function<void()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()> > (
__f=@0x13344fe8: 0x8433080 <util::TraceThread(char const*, std::function<void ()>)>) at /usr/include/c++/10/bits/invoke.h:60
[#22](/bitcoin-bitcoin/22/) std::__invoke<void (*)(char const*, std::function<void()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()> > (
__fn=@0x13344fe8: 0x8433080 <util::TraceThread(char const*, std::function<void ()>)>) at /usr/include/c++/10/bits/invoke.h:95
[#23](/bitcoin-bitcoin/23/) std::thread::_Invoker<std::tuple<void (*)(char const*, std::function<void()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()> > >::_M_invoke<0, 1, 2> (
this=0x13344fb8) at /usr/include/c++/10/thread:264
[#24](/bitcoin-bitcoin/24/) std::thread::_Invoker<std::tuple<void (*)(char const*, std::function<void()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()> > >::operator() (
this=0x13344fb8) at /usr/include/c++/10/thread:271
[#25](/bitcoin-bitcoin/25/) std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(char const*, std::function<void()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::<lambda()> > > >::_M_run(void) (this=0x13344fb0) at /usr/include/c++/10/thread:215
[#26](/bitcoin-bitcoin/26/) 0x00007fffff4beed0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
[#27](/bitcoin-bitcoin/27/) 0x00007fffff796ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
[#28](/bitcoin-bitcoin/28/) 0x00007fffff19ddef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Last logs displayed (running bitcoind with -debug=all) before the crash when running inside gdb (with current sources sync'ed from this git repo).
2022-08-16T08:41:08.970168Z [loadblk] [validationinterface.cpp:199] [UpdatedBlockTip] [validation] Enqueuing UpdatedBlockTip: new block hash=00000000000000000007797ea03040a6ce4bbba93edc0797be66593f342b0e80 fork block hash=000000000000000000035e2d3a32a3249d4db7ef6c89db3a9f5d8e5111046285 (in IBD=true)
2022-08-16T08:41:08.970455Z [scheduler] [validationinterface.cpp:227] [operator()] [validation] BlockConnected: block hash=00000000000000000007797ea03040a6ce4bbba93edc0797be66593f342b0e80 block height=661432
2022-08-16T08:41:08.982873Z [loadblk] [validation.cpp:2717] [ConnectTip] [bench] - Load block from disk: 12.38ms [1.19s (14.02ms/blk)]
2022-08-16T08:41:08.985121Z [loadblk] [validation.cpp:2060] [ConnectBlock] [bench] - Sanity checks: 2.00ms [0.19s (2.20ms/blk)]
2022-08-16T08:41:08.985349Z [loadblk] [validation.cpp:2159] [ConnectBlock] [bench] - Fork checks: 0.23ms [0.02s (0.23ms/blk)]
2022-08-16T08:41:09.695210Z [loadblk] [validation.cpp:2244] [ConnectBlock] [bench] - Connect 1308 transactions: 709.85ms (0.543ms/tx, 0.113ms/txin) [47.74s (555.09ms/blk)]
2022-08-16T08:41:09.695478Z [loadblk] [validation.cpp:2257] [ConnectBlock] [bench] - Verify 6271 txins: 710.13ms (0.113ms/txin) [47.76s (555.36ms/blk)]
2022-08-16T08:41:09.695698Z [loadblk] [validation.cpp:2267] [ConnectBlock] [bench] - Write undo data: 0.22ms [0.02s (0.22ms/blk)]
2022-08-16T08:41:09.695895Z [loadblk] [validation.cpp:2278] [ConnectBlock] [bench] - Index writing: 0.20ms [0.02s (0.19ms/blk)]
2022-08-16T08:41:09.696274Z [loadblk] [validationinterface.cpp:251] [BlockChecked] [validation] BlockChecked: block hash=0000000000000000000b5996770f8489d67422b9797569fc4f7ff78d06029943 state=Valid
2022-08-16T08:41:09.696475Z [loadblk] [validation.cpp:2729] [ConnectTip] [bench] - Connect total: 713.62ms [48.01s (558.28ms/blk)]
2022-08-16T08:41:09.702334Z [loadblk] [validation.cpp:2734] [ConnectTip] [bench] - Flush: 5.86ms [0.64s (7.47ms/blk)]
2022-08-16T08:41:09.702531Z [loadblk] [validation.cpp:2740] [ConnectTip] [bench] - Writing chainstate: 0.20ms [0.02s (0.22ms/blk)]
2022-08-16T08:41:09.703023Z [loadblk] [validation.cpp:2511] [UpdateTipLog] UpdateTip: new best=0000000000000000000b5996770f8489d67422b9797569fc4f7ff78d06029943 height=661433 version=0x20006000 log2_work=92.516788 tx=596277697 date='2020-12-15T05:08:04Z' progress=0.788542 cache=79.7MiB(606180txo)
2022-08-16T08:41:09.703239Z [loadblk] [validation.cpp:2751] [ConnectTip] [bench] - Connect postprocess: 0.71ms [0.08s (0.95ms/blk)]
2022-08-16T08:41:09.703429Z [loadblk] [validation.cpp:2752] [ConnectTip] [bench] - Connect block: 732.76ms [49.95s (580.77ms/blk)]
2022-08-16T08:41:09.703618Z [loadblk] [txmempool.cpp:736] [check] [mempool] Checking mempool with 0 transactions and 0 inputs
2022-08-16T08:41:09.703806Z [loadblk] [validationinterface.cpp:227] [BlockConnected] [validation] Enqueuing BlockConnected: block hash=0000000000000000000b5996770f8489d67422b9797569fc4f7ff78d06029943 block height=661433
2022-08-16T08:41:09.704008Z [loadblk] [validationinterface.cpp:199] [UpdatedBlockTip] [validation] Enqueuing UpdatedBlockTip: new block hash=0000000000000000000b5996770f8489d67422b9797569fc4f7ff78d06029943 fork block hash=00000000000000000007797ea03040a6ce4bbba93edc0797be66593f342b0e80 (in IBD=true)
2022-08-16T08:41:09.711612Z [loadblk] [validation.cpp:2717] [ConnectTip] [bench] - Load block from disk: 7.41ms [1.20s (13.94ms/blk)]
2022-08-16T08:41:09.713156Z [loadblk] [validation.cpp:2060] [ConnectBlock] [bench] - Sanity checks: 1.24ms [0.19s (2.19ms/blk)]
2022-08-16T08:41:09.713345Z [loadblk] [validation.cpp:2159] [ConnectBlock] [bench] - Fork checks: 0.19ms [0.02s (0.22ms/blk)]
2022-08-16T08:41:09.723584Z [loadblk] [dbwrapper.h:250] [Read] LevelDB read failure: Corruption: block checksum mismatch: /mnt/g/bitcoin/chainstate/308716.ldb
2022-08-16T08:41:09.723798Z [loadblk] [dbwrapper.cpp:246] [HandleError] Fatal LevelDB error: Corruption: block checksum mismatch: /mnt/g/bitcoin/chainstate/308716.ldb
2022-08-16T08:41:09.723998Z [loadblk] [dbwrapper.cpp:247] [HandleError] You can use -debug=leveldb to get more complete diagnostic messages
2022-08-16T08:41:09.724248Z [loadblk] [noui.cpp:43] [noui_ThreadSafeMessageBox] Error: Error reading from database, shutting down.
Error: Error reading from database, shutting down.
2022-08-16T08:41:09.724697Z [loadblk] [coins.cpp:302] [GetCoin] Error reading from database: Fatal LevelDB error: Corruption: block checksum mismatch: /mnt/g/bitcoin/chainstate/308716.ldb
Thread 15 "b-loadblk" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff32f60700 (LWP 14607)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb)
Running on Debian Running on Debian bullseye InRelease (with all current apt updates).
Note that restarting bitcoind (with -checklevel=4 -checkblock=6) just restarts from a recent height, and does not detect any corruption, it processes a few dozens of blocks for a couple of minutes and crashes again. Retrying restarts from the same blockheight.
I've checked the leveldb with external tools, and did not find any corruption or missing index in the key indexes, or any incorrect sort of keys in the 6 levels, or any corruption with dummy/partial records in the journal or sorted indexes.