Electrs: std::bad_alloc keep getting this after ~ 30min

Created on 27 Aug 2019  路  14Comments  路  Source: romanz/electrs

Everytime i start it and it go on parsing the info to the DB it crashes after around 1000 blocks with the error below, my machine is a 10GB 4CPU.

TRACE - parsing 133763593 bytes
TRACE - reading "/root/.bitcoin/blocks/blk00967.dat"
TRACE - fetched 139 blocks
DEBUG - writing 1935011 rows to RocksDB { path: "./db/mainnet/newindex/history" }, flush=Disable
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Killed

Any tips?

bug

All 14 comments

This is indeed weird, because the error seems to be related to out-of-memory condition.
Could you try running electrs in "low-memory" mode using JSON RPC-based sync?

$ cargo run --release -- -vvvv --index-batch-size=10 --jsonrpc-import

It should take more time, but use less RAM.

Closing, please re-open if still relevant.

Also have run into this error:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

This is from a fork at https://github.com/Blockstream/electrs/commit/d6486e7d2ec7127ef5efffc83f9e725dc019d8c0.

Does running with:

$ cargo run --release -- -vvvv --index-batch-size=10 --jsonrpc-import

help?

I will try that, I just switched to debug build as well.

It looks like --index-batch-size isn't a recognized option for ./electrs/target/debug/electrs, maybe this isn't option with https://github.com/Blockstream/electrs/commit/d6486e7d2ec7127ef5efffc83f9e725dc019d8c0? Also, I've noticed that SIGINT (Ctrl+C) doesn't close the program.

Currently, https://github.com/Blockstream/electrs/ is a fork of this repository - so not all options are supported...
Which hardware are you using to run Esplora on?

A Xeon server with 8GB of memory.

I also realized I forcibly closed the program, since Ctrl-C wasn't working. I'm assuming this case is handled and recoverable. May not be related. However, I've flushed the database, and started it fresh.

Maybe running with https://github.com/Blockstream/electrs#light-mode can help?
Also I suggest moving the discussion to https://github.com/Blockstream/esplora/issues, to get more feedback from Esplora developers :)

Yeah, there is an issue at https://github.com/Blockstream/esplora/issues/142 for this also.

I haven't run into this issue again (yet) after I flushed the db (removed the directory) and ran the debug build. I wonder if there was a rocksdb repair that was running and attempting to use lots of memory; I've run into a similar issue with leveldb.

Unfortunately, it has happened again. Looks like it happens later in the process when writing to txstore. I'll try using light-mode, and then using this branch (and if necessary the options).

Okay great. So with this branch ba12177404b7b694f49de519707317b4e4ca9e96 there wasn't an issue at all. Thanks! I ended up not needing to use the --index-batch-size or --jsonrpc-import options. So it ends up that the issue is specific with the Esplora electrs fork.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kixunil picture Kixunil  路  3Comments

reynico picture reynico  路  5Comments

seth586 picture seth586  路  3Comments

kyuupichan picture kyuupichan  路  5Comments

Emanresueht picture Emanresueht  路  8Comments