124th peer connection closed every second #33267

issue lnxsrt openend this issue on August 28, 2025
  1. lnxsrt commented at 12:54 pm on August 28, 2025: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    I’m on Bitcoin Core v29.0.0

    I noticed that when at the max number of peers (124 total; 10 outbound; 114 inbound) the most recent peer connection is continually dropped after 1 second and another peer is selected. I can’t imagine this is good behavior for the network.

    As you can see, my peer count is very high (basically == number of seconds I’ve been at 124 peers) and the most recent peer only ever has an age of 1s.

    Expected behaviour

    I would expect the program to stop accepting connections when peers == max_peers, instead of accepting the connection and dropping it 1 second later.

    Steps to reproduce

    Leave client running on a high speed network long enough to hit 124 peers.

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    v29.0.0

    Operating system and version

    FreeBSD 14.3

    Machine specifications

    No response

  2. 0xB10C commented at 1:37 pm on August 28, 2025: contributor

    This is likely normal behavior and not a bug. What you are seeing is Bitcoin Core’s inbound connection eviction in action. When a new inbound connection comes in, another connection may be closed in favor of it. This avoids an attacker filling all of your inbound connections in an attempt to eclipse you from the network. The inbound eviction algorithm takes care to protect certain peers from being disconnected - you can find details here.

    the most recent peer connection is continually dropped after 1 second and another peer is selected. I can’t imagine this is good behavior for the network.

    The connection that’s repeatedly dropped is probably an inbound connection from a network group (a /16 IP address range) with many existing inbound connections to you.

    https://github.com/bitcoin/bitcoin/blob/6ca6f3b37b992591726bd13b494369bee3bd6468/src/node/eviction.cpp#L238-L239

    As you can see, my peer count is very high

    Given you have already seen 3.2M peers, there’s probably someone frequently reconnecting to your node from the same network group(s). Based on what I see at my nodes, my guess is that this is related to LinkingLion. If the IP addresses match, you could consider banning the related subnets to avoid these connections.

  3. maflcko added the label Questions and Help on Aug 28, 2025
  4. maflcko added the label P2P on Aug 28, 2025
  5. maflcko closed this on Aug 28, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-09-02 12:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me