Skip to content

Memory leak with rest/block REST endpoint and getblock RPC when verbosity >=2 #30052

@achow101

Description

@achow101

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

Reported in https://bitcointalk.org/index.php?topic=5495435.msg64037741#msg64037741

When using either the rest/block endpoint or the getblock rpc with verbosity >=2, there appears to be a memory leak. Memory usage goes up ~100 MB for each call.

The original reporter is repeatedly hitting the rest endpoint and eventually OOM'ing.

Expected behaviour

Memory should be freed after a response is sent, or be capped at some point to prevent an OOM.

Steps to reproduce

Observe bitcoind memory usage in top. Do getblock <blockhash> 2 and observe the memory usage increase. It fairly reliably reproduces, but does not always occur. Different blocks seem to have different effects, and repeating a block does not always increase usage.

Relevant log output

No response

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

v27.99.0-eb0bdbdd753b

Operating system and version

Arch

Machine specifications

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions