bitcoin: RPC `getblock` resulted in 500 and ReadBlockFromDisk: OpenBlockFile failed for FlatFilePos(nFile=-1, nPos=0)
Invoking HTTP RPC getblock
resulted in the following failure:
status_code: 500 status: Internal Server Error response_body: {"result":null,"error":{"code":-1,"message":"Block not found on disk"}
The logs have shown:
2021-01-21T16:48:53Z Pre-allocating up to position 0x400000 in rev02417.dat
2021-01-21T16:48:53Z UpdateTip: new best=00000000000000000005656edcf6fb5cea1d2fe392841a9bdaa8b1fa821df661 height=667046 version=0x20004000 log2_work=92.608345 tx=608416058 date='2021-01-21T16:48:23Z' progress=1.000000 cache=95.6MiB(725599txo) warning='73 of last 100 blocks have unexpected version'
2021-01-21T16:59:14Z UpdateTip: new best=0000000000000000000383edc4ee51e5e55000c85ae844899e582aedc6d0cb2f height=667047 version=0x2000e000 log2_work=92.608362 tx=608418465 date='2021-01-21T16:58:42Z' progress=1.000000 cache=96.9MiB(735971txo) warning='73 of last 100 blocks have unexpected version'
2021-01-21T17:13:25Z ERROR: ReadBlockFromDisk: OpenBlockFile failed for FlatFilePos(nFile=-1, nPos=0)
2021-01-21T17:13:25Z UpdateTip: new best=0000000000000000000bc7c177f0ef9fa47492beb5c14250c6d412b12997a56b height=667048 version=0x20000000 log2_work=92.608379 tx=608421018 date='2021-01-21T17:13:24Z' progress=1.000000 cache=98.4MiB(747960txo) warning='72 of last 100 blocks have unexpected version'
2021-01-21T17:16:06Z UpdateTip: new best=000000000000000000034359728a89d359e6859f6908145594888c26f952dcb7 height=667049 version=0x20600000 log2_work=92.608396 tx=608423202 date='2021-01-21T17:15:51Z' progress=1.000000 cache=99.2MiB(754485txo) warning='73 of last 100 blocks have unexpected version'
Expected behavior
No error
Actual behavior
RPC 500 error returned and ReadBlockFromDisk ERROR logged.
To reproduce
Unknown.
System information
AWS K8S 4 CPUs/8Gi RAM, GP3 EBS 3000 IOPS/125Mips
2021-01-21T15:30:54Z Bitcoin Core version v0.20.1 (release build)
2021-01-21T15:30:54Z Assuming ancestors of block 0000000000000000000f2adce67e49b0b6bdeb9de8b7c3d7e93b21e7fc1e819d have valid signatures.
2021-01-21T15:30:54Z Setting nMinimumChainWork=00000000000000000000000000000000000000000e1ab5ec9348e9f4b8eb8154
2021-01-21T15:30:54Z Using the 'shani(1way,2way)' SHA256 implementation
2021-01-21T15:30:54Z Using RdSeed as additional entropy source
2021-01-21T15:30:54Z Using RdRand as an additional entropy source
2021-01-21T15:30:54Z Default data directory /root/.bitcoin
2021-01-21T15:30:54Z Using data directory /home/bitcoin/.bitcoin
2021-01-21T15:30:54Z Config file: /home/bitcoin/.bitcoin/bitcoin.conf (not found, skipping)
2021-01-21T15:30:54Z Command-line arg: datadir="/home/bitcoin/.bitcoin"
2021-01-21T15:30:54Z Command-line arg: rpcallowip="100.64.0.0/10"
2021-01-21T15:30:54Z Command-line arg: rpcbind=****
2021-01-21T15:30:54Z Command-line arg: rpcpassword=****
2021-01-21T15:30:54Z Command-line arg: rpcport="18332"
2021-01-21T15:30:54Z Command-line arg: rpcuser=****
2021-01-21T15:30:54Z Command-line arg: rpcworkqueue="4096"
2021-01-21T15:30:54Z Command-line arg: server=""
2021-01-21T15:30:54Z Command-line arg: txindex="1"
2021-01-21T15:30:54Z Using at most 125 automatic connections (1048576 file descriptors available)
2021-01-21T15:30:54Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-01-21T15:30:54Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-01-21T15:30:54Z Script verification uses 7 additional threads
2021-01-21T15:30:54Z scheduler thread start
2021-01-21T15:30:54Z WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet
2021-01-21T15:30:54Z HTTP: creating work queue of depth 4096
2021-01-21T15:30:54Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2021-01-21T15:30:54Z HTTP: starting 4 worker threads
2021-01-21T15:30:54Z Using wallet directory /home/bitcoin/.bitcoin
2021-01-21T15:30:54Z init message: Verifying wallet(s)...
2021-01-21T15:30:54Z Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
2021-01-21T15:30:54Z Using wallet /home/bitcoin/.bitcoin
2021-01-21T15:30:54Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin/.bitcoin/database ErrorFile=/home/bitcoin/.bitcoin/db.log
2021-01-21T15:30:54Z init message: Loading banlist...
2021-01-21T15:30:54Z Using /16 prefix for IP bucketing
2021-01-21T15:30:54Z Cache configuration:
2021-01-21T15:30:54Z * Using 2.0 MiB for block index database
2021-01-21T15:30:54Z * Using 56.0 MiB for transaction index database
2021-01-21T15:30:54Z * Using 8.0 MiB for chain state database
2021-01-21T15:30:54Z * Using 384.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2021-01-21T15:30:54Z init message: Loading block index...
2021-01-21T15:30:54Z Opening LevelDB in /home/bitcoin/.bitcoin/blocks/index
2021-01-21T15:30:54Z Opened LevelDB successfully
2021-01-21T15:30:54Z Using obfuscation key for /home/bitcoin/.bitcoin/blocks/index: 0000000000000000
2021-01-21T15:30:58Z LoadBlockIndexDB: last block file = 2417
2021-01-21T15:30:58Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=6, size=8006735, heights=667029...667034, time=2021-01-21...2021-01-21)
2021-01-21T15:30:58Z Checking all blk files are present...
2021-01-21T15:30:58Z Opening LevelDB in /home/bitcoin/.bitcoin/chainstate
2021-01-21T15:30:58Z Opened LevelDB successfully
2021-01-21T15:30:58Z Using obfuscation key for /home/bitcoin/.bitcoin/chainstate: 8d04dcac7c5beaa0
2021-01-21T15:30:58Z Loaded best chain: hashBestChain=000000000000000000029ce801aba0474f571370c0f12808bae6501cf9ca1cec height=667034 date=2021-01-21T15:13:02Z progress=0.999994
2021-01-21T15:30:58Z init message: Rewinding blocks...
2021-01-21T15:30:58Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) started
2021-01-21T15:30:58Z FlushStateToDisk: write coins cache to disk (0 coins, 0kB) completed (0.00s)
2021-01-21T15:30:58Z init message: Verifying blocks...
2021-01-21T15:30:58Z Verifying last 6 blocks at level 3
2021-01-21T15:30:58Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2021-01-21T15:31:03Z No coin database inconsistencies in last 6 blocks (11765 transactions)
2021-01-21T15:31:03Z block index 9520ms
2021-01-21T15:31:03Z Opening LevelDB in /home/bitcoin/.bitcoin/indexes/txindex
2021-01-21T15:31:03Z Opened LevelDB successfully
2021-01-21T15:31:03Z Using obfuscation key for /home/bitcoin/.bitcoin/indexes/txindex: 0000000000000000
2021-01-21T15:31:03Z init message: Loading wallet...
2021-01-21T15:31:03Z txindex thread start
2021-01-21T15:31:03Z txindex is enabled at height 667034
2021-01-21T15:31:03Z txindex thread exit
2021-01-21T15:31:03Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin/.bitcoin/database ErrorFile=/home/bitcoin/.bitcoin/db.log
2021-01-21T15:31:03Z [default wallet] Wallet File Version = 169900
2021-01-21T15:31:03Z [default wallet] Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total. Unknown wallet records: 0
2021-01-21T15:31:03Z [default wallet] Wallet completed loading in 35ms
2021-01-21T15:31:03Z [default wallet] setKeyPool.size() = 2000
2021-01-21T15:31:03Z [default wallet] mapWallet.size() = 0
2021-01-21T15:31:03Z [default wallet] m_address_book.size() = 0
2021-01-21T15:31:03Z block tree size = 667038
2021-01-21T15:31:03Z nBestHeight = 667034
2021-01-21T15:31:03Z torcontrol thread start
2021-01-21T15:31:03Z Bound to [::]:8333
2021-01-21T15:31:03Z Bound to 0.0.0.0:8333
2021-01-21T15:31:03Z init message: Loading P2P addresses...
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 18 (9 by maintainers)
I suspect that there was a race on our end too… the node probably had started processing the block when the RPC request came in, and it tried to look for something that it knew about but wasn’t on disk yet.
Looks like a race on your side