spesmilo / spesmilo/electrumx

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 1022035: invalid start byte

Open
#49 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
568
Forks
447
PR merge metrics
No merged PRs in 30d

Description

ElectrumX been running for 5 days straight and just crashed with error:

2020-08-08 04:56:34,674:WARNING:Controller:received SIGINT signal, initiating shutdown
2020-08-08 04:56:34,689:ERROR:electrumx:ElectrumX server terminated abnormally
Traceback (most recent call last):
  File "/home/nv01/.local/bin/electrumx_server", line 35, in main
    asyncio.run(controller.run())
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/lib/server_base.py", line 125, in run
    await server_task
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/lib/server_base.py", line 98, in serve
    await self.serve(shutdown_event)
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/controller.py", line 134, in serve
    await group.spawn(wait_for_catchup())
  File "/usr/local/lib/python3.7/dist-packages/aiorpcx/curio.py", line 242, in __aexit__
    await self.join()
  File "/usr/local/lib/python3.7/dist-packages/aiorpcx/curio.py", line 211, in join
    raise task.exception()
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/mempool.py", line 335, in keep_synchronized
    await group.spawn(self._logging(synchronized_event))
  File "/usr/local/lib/python3.7/dist-packages/aiorpcx/curio.py", line 242, in __aexit__
    await self.join()
  File "/usr/local/lib/python3.7/dist-packages/aiorpcx/curio.py", line 211, in join
    raise task.exception()
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/mempool.py", line 218, in _refresh_hashes
    hex_hashes = await self.api.mempool_hashes()
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/daemon.py", line 233, in mempool_hashes
    return await self._send_single('getrawmempool')
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/daemon.py", line 176, in _send_single
    return await self._send(payload, processor)
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/daemon.py", line 134, in _send
    result = await self._send_data(data)
  File "/home/nv01/.local/lib/python3.7/site-packages/electrumx/server/daemon.py", line 108, in _send_data
    return await resp.json(loads=json_deserialize)
  File "/usr/local/lib/python3.7/dist-packages/aiohttp/client_reqrep.py", line 1040, in json
    return loads(stripped.decode(encoding))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 1022035: invalid start byte

dmesg says:

[Mon Aug  3 19:47:08 2020] electrumx_serve[3458550]: segfault at 0 ip 0000000000000000 sp 00007ffce9084e28 error 14 in python3.7[400000+21000]
[Mon Aug  3 19:47:08 2020] Code: Bad RIP value.

System info:
OS: Debian GNU/Linux 10 (buster) x86_64
Kernel: 5.6.0-0.bpo.2-amd64

ElectrumX latest from git

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the daemon response path in server/daemon.py, especially _send_data, and trace how mempool synchronization reaches it from server/mempool.py. Reproduce or isolate the invalid UTF-8 response if possible, then add coverage showing the server handles this failure without terminating unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.