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

Excessive memory consumption (>40G) after upgrading from 1.27.0 to 1.30.3 #8020

Open
Ragnaruk opened this issue Jan 7, 2025 · 6 comments
Open
Assignees
Labels
[Pri] Medium Medium priority
Milestone

Comments

@Ragnaruk
Copy link

Ragnaruk commented Jan 7, 2025

Description
After upgrading Nethermind from 1.27.0 to 1.30.3 it started consuming (leaking?) memory at a pretty alarming rate.

I am using Nethermind as an RPC node, and it looks like it is at least somewhat related ­— without any load memory consumption seems stable.

Rate of requests if needed:

eth_getCode: ~2k/min
eth_getTransactionReceipt: ~2k/min
trace_transaction: ~600/min
eth_blockNumber: ~20/min
eth_getBlockByNumber: ~20/min

Screenshots
image
image

Desktop (please complete the following information):

  • Operating System: Rocky Linux
  • Version: 8.10 (Green Obsidian)
  • Installation Method: Docker
  • Consensus Client: Prysm v5.2.0
@Ragnaruk
Copy link
Author

Ragnaruk commented Jan 8, 2025

Looks like the problem is with the trace_transaction requests.

Disabling them stabilized memory usage, but didn't reduce it. After a restart, everything returned to normal.

Looks like either the caching is too aggressive or the memory simply isn't released.
image

@kamilchodola
Copy link
Contributor

Hi @Ragnaruk !

Thanks for the report! We will take a look at that as a priority to fix it asap.

@kamilchodola
Copy link
Contributor

kamilchodola commented Jan 9, 2025

@brbrr Please reproduce it on our infra.

@benaadams Did we had any performance optimizations for tarce calls in last versions?

@kamilchodola kamilchodola added this to the 1.31.0 milestone Jan 9, 2025
@brbrr
Copy link
Contributor

brbrr commented Jan 23, 2025

@Ragnaruk, could you share some of the trace_transaction requests? that would be greatly appreciated! Also, to confirm - it is happening on mainnet?

@Ragnaruk
Copy link
Author

Ragnaruk commented Jan 23, 2025

Yes, mainnet.

Here's a quick reproduction:

#!/bin/bash

URL="http://127.0.0.1:8545"
HEADER="Content-Type: application/json"

for i in $(seq 1 100);
do
    block_number=$(curl -s -X POST -H "$HEADER" "$URL" -d '{"jsonrpc":"1.0","id":0,"method":"eth_blockNumber","params":[]}' | jq .result);
    echo "$(date -u) - Block: $block_number";

    transactions=( $(curl -s -X POST -H "$HEADER" "$URL" -d "{\"jsonrpc\":\"1.0\",\"id\":0,\"method\":\"eth_getBlockByNumber\",\"params\":[$block_number]}" | jq .result.transactions | sed -e 's/[][]//g' -e 's/[,]//g' ) );
    echo "$(date -u) - Transactions: ${#transactions[@]}";

    for txhash in "${transactions[@]}";
    do
      curl -s -o /dev/null -X POST -H "$HEADER" "$URL" -d "{\"jsonrpc\":\"1.0\",\"id\":0,\"method\":\"trace_transaction\",\"params\":[$txhash]}"&
      sleep 0.1;
    done
done

@brbrr
Copy link
Contributor

brbrr commented Jan 24, 2025

@Ragnaruk thanks! that's very helpful!
I've been running the (a bit modified) stript that you provided, and I definitely see the memory growth. I'll pass it to the developers and hopefully it would be fixed soon

my version of the script:

URL="http://127.0.0.1:8545"
HEADER="Content-Type: application/json"

for i in $(seq 1 500); do
    block_number=$(curl -s -X POST -H "$HEADER" "$URL" -d '{"jsonrpc":"2.0","id":0,"method":"eth_blockNumber","params":[]}' | jq -r .result)
    if [[ -z "$block_number" ]]; then
        echo "$(date -u) - Failed to fetch block number"
        continue
    fi

    transactions=$(curl -s -X POST -H "$HEADER" "$URL" -d "{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"eth_getBlockByNumber\",\"params\":[\"$block_number\" ]}" | jq -r '.result.transactions[]?')
    if [[ -z "$transactions" ]]; then
        echo "$(date -u) - No transactions in block $block_number"
        continue
    fi

    while read -r txhash; do
        trace=$(curl -s -X POST -H "$HEADER" "$URL" -d "{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"trace_transaction\",\"params\":[\"$txhash\"]}"&)
        echo "Trace result: $trace"
        sleep 0.1
    done <<< "$transactions"
done

@brbrr brbrr added the [Pri] Medium Medium priority label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Medium Medium priority
Projects
None yet
Development

No branches or pull requests

3 participants