Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB::FileNotFoundError 'meta/headers00' on electrumx_server first run #182

Open
tadeubas opened this issue Jun 13, 2022 · 0 comments
Open

Comments

@tadeubas
Copy link

Electrumx crashes everytime during flushing the history...

I've reduced DB cache to 20MB in order to test faster, the DB folder was populated only with hist and utxo folders...

Then I deleted the DB folder and tried to run electrumx_compact_history, it failed with AssertionError, but I noticed it created on the DB folder now with hist, utxo and meta folders inside... then on the next try of electrumx_server it runned right away! 😄

STDOUT of python3.8 electrumx_compact_history:

INFO:root:Starting history compaction...
INFO:electrumx.server.db.DB:switching current directory to /home/tadeu/Tadeu/db_electrumx/
INFO:electrumx.server.db.DB:using leveldb for DB backend
INFO:electrumx.server.db.DB:created new database
INFO:electrumx.server.db.DB:creating metadata directory
INFO:electrumx.server.db.DB:UTXO DB version: 8
INFO:electrumx.server.db.DB:coin: Bitcoin
INFO:electrumx.server.db.DB:network: mainnet
INFO:electrumx.server.db.DB:height: -1
INFO:electrumx.server.db.DB:tip: 0000000000000000000000000000000000000000000000000000000000000000
INFO:electrumx.server.db.DB:tx count: 0
INFO:electrumx.server.db.DB:flushing DB cache at 20 MB
INFO:electrumx.server.db.DB:sync time so far: 00s
INFO:electrumx.server.history.History:history DB version: 1
INFO:electrumx.server.history.History:flush count: 0
Traceback (most recent call last):
  File "electrumx_compact_history", line 73, in main
    loop.run_until_complete(compact_history())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "electrumx_compact_history", line 53, in compact_history
    assert not db.first_sync
AssertionError
CRITICAL:root:History compaction terminated abnormally

STDOUT of python3.8 electrumx_server

INFO:electrumx:ElectrumX server starting
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.8.0 (default, Dec  9 2021, 17:53:27)  [GCC 8.4.0]
INFO:Controller:software version: ElectrumX 1.16.0
INFO:Controller:aiorpcX version: 0.22.1
INFO:Controller:supported protocol versions: 1.4-1.4.2
INFO:Controller:event loop policy: None
INFO:Controller:reorg limit is 200 blocks
INFO:Daemon:daemon #1 at 127.0.0.1:8332/ (current)
INFO:DB:switching current directory to /home/tadeu/Tadeu/db_electrumx/
INFO:DB:using leveldb for DB backend
INFO:DB:opened UTXO DB (for sync: True)
INFO:DB:UTXO DB version: 8
INFO:DB:coin: Bitcoin
INFO:DB:network: mainnet
INFO:DB:height: -1
INFO:DB:tip: 0000000000000000000000000000000000000000000000000000000000000000
INFO:DB:tx count: 0
INFO:DB:flushing DB cache at 20 MB
INFO:DB:sync time so far: 00s
INFO:History:history DB version: 1
INFO:History:flush count: 0
INFO:Prefetcher:catching up to daemon height 740,667 (740,668 blocks behind)
INFO:Prefetcher:verified genesis block with hash 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
INFO:BlockProcessor:our height: 9 daemon: 740,667 UTXOs 0MB hist 0MB
INFO:BlockProcessor:our height: 41,009 daemon: 740,667 UTXOs 7MB hist 10MB
INFO:Prefetcher:cancelled; prefetcher stopping
INFO:Controller:shutting down
INFO:Controller:shutdown complete
ERROR:electrumx:ElectrumX server terminated abnormally
Traceback (most recent call last):
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/util.py", line 246, in open_file
    return open(filename, 'rb+')
FileNotFoundError: [Errno 2] No such file or directory: 'meta/headers00'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "electrumx_server", line 35, in main
    asyncio.run(controller.run())
  File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 608, in run_until_complete
    return future.result()
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/server_base.py", line 129, in run
    await server_task
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/server_base.py", line 102, in serve
    await self.serve(shutdown_event)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/controller.py", line 134, in serve
    await group.spawn(wait_for_catchup())
  File "/home/tadeu/.local/lib/python3.8/site-packages/aiorpcx/curio.py", line 297, in __aexit__
    await self.join()
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/util.py", line 370, in join
    task.result()
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 702, in fetch_and_process_blocks
    await group.spawn(self._process_prefetched_blocks())
  File "/home/tadeu/.local/lib/python3.8/site-packages/aiorpcx/curio.py", line 297, in __aexit__
    await self.join()
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/util.py", line 370, in join
    task.result()
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 663, in _process_prefetched_blocks
    await self.check_and_advance_blocks(blocks)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 230, in check_and_advance_blocks
    await self._maybe_flush()
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 368, in _maybe_flush
    await self.flush(flush_arg)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 358, in flush
    await self.run_in_thread_with_lock(flush)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 212, in run_in_thread_with_lock
    return await asyncio.shield(run_in_thread_locked())
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 211, in run_in_thread_locked
    return await run_in_thread(func, *args)
  File "/home/tadeu/.local/lib/python3.8/site-packages/aiorpcx/curio.py", line 57, in run_in_thread
    return await get_event_loop().run_in_executor(None, func, *args)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/block_processor.py", line 356, in flush
    self.db.flush_dbs(self.flush_data(), flush_utxos,
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/db.py", line 241, in flush_dbs
    self.flush_fs(flush_data)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/server/db.py", line 295, in flush_fs
    self.headers_file.write(offset, b''.join(flush_data.headers))
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/util.py", line 226, in write
    with self.open_file(start, True) as f:
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/util.py", line 238, in open_file
    f = open_file(filename, create)
  File "/mnt/c/Users/Tadeu/Documents/Projetos GIT/electrumx/electrumx/lib/util.py", line 249, in open_file
    return open(filename, 'wb+')
FileNotFoundError: [Errno 2] No such file or directory: 'meta/headers00'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant