spesmilo / spesmilo/electrumx

electrumx memory leak

Open
#77 19 comments 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

Another memory leak has been found.
Screenshot at 2020-11-03 01-20-45

I am using older, stable version on electrumx, since problems with memory leak last time, I settled on older, stable version and stayed there.

commit 835aa492e9a3563d89d99c35168378d65321b849 (HEAD, tag: 1.15.0)
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Wed May 27 11:23:38 2020 +0100

    Prepare 1.15

This memory leak is a lot slower. Process has reached 5 GB RAM after 6 days:

 electrumx_rpc getinfo
{
    "coin": "BitcoinSegwit",
    "daemon": "localhost:8332/",
    "daemon height": 655159,
    "db height": 655159,
    "db_flush_count": 1648,
    "groups": 3115,
    "history cache": "3,243,657 lookups 536,633 hits 1,000 entries",
    "merkle cache": "22,953 lookups 10,313 hits 1,000 entries",
    "peers": {
        "bad": 6,
        "good": 71,
        "never": 12,
        "stale": 14,
        "total": 103
    },
    "pid": 501797,
    "request counts": {
        "blockchain.block.header": 70370,
        "blockchain.block.headers": 2660,
        "blockchain.estimatefee": 23735419,
        "blockchain.headers.subscribe": 135572,
        "blockchain.relayfee": 24953,
        "blockchain.scripthash.get_balance": 283748,
        "blockchain.scripthash.get_history": 155753,
        "blockchain.scripthash.listunspent": 165276,
        "blockchain.scripthash.subscribe": 2920814,
        "blockchain.transaction.broadcast": 1511,
        "blockchain.transaction.get": 43903,
        "blockchain.transaction.get_merkle": 23266,
        "getinfo": 41,
        "mempool.get_fee_histogram": 1897426,
        "server.add_peer": 1146,
        "server.banner": 24969,
        "server.donation_address": 24962,
        "server.features": 10299,
        "server.peers.subscribe": 78146,
        "server.ping": 1464476,
        "server.version": 3696202
    },
    "request total": 34760912,
    "sessions": {
        "count": 931,
        "count with subs": 248,
        "errors": 21,
        "logged": 0,
        "pending requests": 37,
        "subs": 114081
    },
    "tx hashes cache": "23,266 lookups 9,745 hits 1,000 entries",
    "txs sent": 1400,
    "uptime": "6d 12h 41m",
    "version": "ElectrumX 1.15.0"
}

Electrum is running perfectly fine, serving a ton of clients, but memory is slowly creeping, 788 MB per day.

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

$ python3 --version
Python 3.7.3
$ pip list |grep aio
aiohttp             3.7.1
aiorpcX             0.18.4

I'd appreciate any help debugging this. What should I upgrade/downgrade first? Waiting for suggestions. I want to make accurate and worthwile test runs, as each test takes few days.

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

No source file or test is identified. Start by reproducing the leak on ElectrumX 1.15.0 with the reported Python, aiohttp, and aiorpcX versions, recording memory and electrumx_rpc getinfo output over several days. Done means identifying the leaking subsystem, fixing it, and confirming memory remains stable in a comparable long-running test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.