python-bitcoin-blockchain-parser icon indicating copy to clipboard operation
python-bitcoin-blockchain-parser copied to clipboard

IOError on LOCK file when running bitcoind

Open satwo opened this issue 7 years ago • 5 comments

When trying to run the parser while bitcoind is also running, I receive the following error:

IOError: b'IO error: lock /home/user/.bitcoin/blocks/index/LOCK: Resource temporarily unavailable'

Running the parser while the node has been shut down does work. I've mitigated this issue by copying /.bitcoin/blocks/ to another directory and referencing that with the parser, but I wonder if I'm missing something. May be related to Issue #43.

satwo avatar May 18 '18 23:05 satwo

After messing around for days trying to find a good way to automate updating my "backup" blocks directory, I tried running the original script again and am now no longer getting the error above. I have no clue what the cause of this could be - is it possible that the above error only displays when a new block is being written to disk?

This is the configuration that worked today, but not previously: blockchain = Blockchain(os.path.expanduser('/home/user/.bitcoin/blocks')) bIterator = blockchain.get_ordered_blocks(os.path.expanduser('/home/user/.bitcoin/blocks/index'), start=height_start,end=height_end + 1)

I'll leave the issue open for a few days in case it occurs again.

satwo avatar Jun 03 '18 21:06 satwo

Indeed this looks like a bug and it happened on my live node.

evd0kim avatar Oct 17 '18 09:10 evd0kim

Unfortunately, it seems that bitcoind's index cannot be read concurrently. Therefore you can run the parser with the node running iff you're not using the get_ordered_blocks method which uses it.

alecalve avatar Oct 17 '18 09:10 alecalve

I thought it is possible to mess around plyvel.DB or at least feed only *.ldb files. However, I try to work with get_unordered_blocks to get all the data I need. Then, maybe, I will try to look for a solution.

evd0kim avatar Oct 17 '18 09:10 evd0kim

Thanks! If there's one I'd be glad to implement it in the project.

alecalve avatar Oct 17 '18 09:10 alecalve