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

Crash after invalidateblock #655

Closed
SomberNight opened this issue Nov 23, 2018 · 2 comments

Comments

@SomberNight
Copy link
Contributor

commented Nov 23, 2018

On bf279ce
Using Bitcoin Core 0.17, on regtest, I call invalidateblock on the tip of the chain:

bitcoin-cli -rpcport=18332 -regtest invalidateblock $(bitcoin-cli -rpcport=18332 -regtest getblockhash 122)

Then ElectrumX crashes:

INFO:MemPool:compact fee histogram: []
INFO:MemPool:synced in 0.01s
INFO:MemPool:0 txs touching 0 addresses
INFO:SessionManager:TCP server listening on 127.0.0.1:50001
INFO:SessionManager:SSL server listening on 127.0.0.1:50002
INFO:PeerManager:peer discovery is disabled
cp1 daemon_height 122, self.fetched_height 122, cache_room 40021
cp2 count 0
cp1 daemon_height 122, self.fetched_height 122, cache_room 40021
cp2 count 0
cp1 daemon_height 121, self.fetched_height 122, cache_room 40021
cp2 count -1
cp3 first 123, count -1, hex_hashes []
INFO:BlockProcessor:flushing to DB for a clean shutdown...
INFO:SessionManager:closing down RPC, TCP, SSL listening servers
ERROR:root:task crashed: <Task finished coro=<Controller.serve() done, defined at /home/user/wspace/electrumx/electrumx/server/controller.py:81> exception=IndexError('list index out of range',)>
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.6/site-packages/aiorpcx/util.py", line 118, in check_task
    task.result()
  File "/home/user/wspace/electrumx/electrumx/server/controller.py", line 131, in serve
    await group.spawn(wait_for_catchup())
  File "/home/user/.local/lib/python3.6/site-packages/aiorpcx/curio.py", line 242, in __aexit__
    await self.join(wait=self._wait)
  File "/home/user/.local/lib/python3.6/site-packages/aiorpcx/curio.py", line 213, in join
    raise task.exception()
  File "/home/user/wspace/electrumx/electrumx/server/block_processor.py", line 661, in fetch_and_process_blocks
    await group.spawn(self._process_prefetched_blocks())
  File "/home/user/.local/lib/python3.6/site-packages/aiorpcx/curio.py", line 242, in __aexit__
    await self.join(wait=self._wait)
  File "/home/user/.local/lib/python3.6/site-packages/aiorpcx/curio.py", line 213, in join
    raise task.exception()
  File "/home/user/wspace/electrumx/electrumx/server/block_processor.py", line 56, in main_loop
    if not await self._prefetch_blocks():
  File "/home/user/wspace/electrumx/electrumx/server/block_processor.py", line 118, in _prefetch_blocks
    .format(first + count-1, hex_hashes[-1]))
IndexError: list index out of range

Introduced by 7f2f9d4

@SomberNight

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2018

After restart, I get #653
so that might be related

Setting count to count = min(500, max(count, 0)) not only prevents the issue occurring in the first place (of course), but fixes the startup problem there.

@kyuupichan

This comment has been minimized.

Copy link
Owner

commented Nov 23, 2018

OK thanks, I'll restore the max with 0

kyuupichan added a commit that referenced this issue Nov 23, 2018

@kyuupichan kyuupichan closed this Nov 23, 2018

cculianu added a commit to cculianu/electrumx that referenced this issue Feb 7, 2019

markblundeberg added a commit to Electron-Cash/electrumx that referenced this issue Feb 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.