Skip to content

qa: Failure in p2p_fingerprint.py #34331

Closed

Description

@hebasto

On FreeBSD 15.0, https://github.com/hebasto/bitcoin-core-nightly/actions/runs/21105606197/job/60696569283:

386/456 - p2p_fingerprint.py failed, Duration: 0 s

stdout:
2026-01-18T04:34:49.101209Z TestFramework (INFO): PRNG seed is: 4679507874993432966
2026-01-18T04:34:49.102528Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63
2026-01-18T04:34:49.360239Z TestFramework (ERROR): Unexpected exception
Traceback (most recent call last):
  File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 138, in main
    self.setup()
  File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 269, in setup
    self.setup_network()
  File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 360, in setup_network
    self.setup_nodes()
  File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 382, in setup_nodes
    self.start_nodes()
  File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 528, in start_nodes
    node.wait_for_rpc_connection()
  File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_node.py", line 316, in wait_for_rpc_connection
    raise FailedToStartError(self._node_msg(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization. Error: Unable to bind to 127.0.0.1:11756 on this computer. Bitcoin Core is probably already running.
Error: Failed to listen on any port. Use -listen=0 if you want this.
************************

2026-01-18T04:34:49.423831Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
2026-01-18T04:34:49.424142Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63
2026-01-18T04:34:49.424336Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63/test_framework.log
2026-01-18T04:34:49.424671Z TestFramework (ERROR): 
2026-01-18T04:34:49.425017Z TestFramework (ERROR): Hint: Call /home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63' to consolidate all logs
2026-01-18T04:34:49.425220Z TestFramework (ERROR): 
2026-01-18T04:34:49.425516Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2026-01-18T04:34:49.425685Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
2026-01-18T04:34:49.425795Z TestFramework (ERROR): 


Activity

  1. maflcko commented on Jan 19, 2026

    @maflcko
    Member

    From the netinet/in.h:

    /*
     * Local port number conventions:
     *
     * When a user does a bind(2) or connect(2) with a port number of zero,
     * a non-conflicting local port address is chosen.
     * The default range is IPPORT_HIFIRSTAUTO through
     * IPPORT_HILASTAUTO, although that is settable by sysctl.
     *
     * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
     * default assignment range.
     *
     * The value IP_PORTRANGE_DEFAULT causes the default behavior.
     *
     * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
     * into the "high" range.  These are reserved for client outbound connections
     * which do not want to be filtered by any firewalls.
     *
     * The value IP_PORTRANGE_LOW changes the range to the "low" are
     * that is (by convention) restricted to privileged processes.  This
     * convention is based on "vouchsafe" principles only.  It is only secure
     * if you trust the remote host to restrict these ports.
     *
     * The default range of ports and the high range can be changed by
     * sysctl(3).  (net.inet.ip.portrange.{hi,low,}{first,last})
     *
     * Changing those values has bad security implications if you are
     * using a stateless firewall that is allowing packets outside of that
     * range in order to allow transparent outgoing connections.
     *
     * Such a firewall configuration will generally depend on the use of these
     * default values.  If you change them, you may find your Security
     * Administrator looking for you with a heavy object.
     *
     * For a slightly more orthodox text view on this:
     *
     *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
     *
     *    port numbers are divided into three ranges:
     *
     *                0 -  1023 Well Known Ports
     *             1024 - 49151 Registered Ports
     *            49152 - 65535 Dynamic and/or Private Ports
     *
     */
    
    /*
     * Ports < IPPORT_RESERVED are reserved for
     * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)
     */
    #define	IPPORT_RESERVED		1024
    
    /*
     * Default local port range, used by IP_PORTRANGE_DEFAULT
     */
    #define IPPORT_EPHEMERALFIRST	10000
    #define IPPORT_EPHEMERALLAST	65535
    
    /*
     * Dynamic port range, used by IP_PORTRANGE_HIGH.
     */
    #define	IPPORT_HIFIRSTAUTO	49152
    #define	IPPORT_HILASTAUTO	65535
    

    So I guess this may have been broken after #34186?

  2. w0xlt commented on Jan 19, 2026

    @w0xlt
    Contributor

    Yes, possibly. FreeBSD’s ephemeral port range (10000–65535) overlaps with the test framework’s static port range (11000–26000).
    Setting TEST_RUNNER_PORT_MIN=2000 in the external bitcoin-core-nightly FreeBSD CI workflow should mitigate this.

  3. maflcko commented on Jan 19, 2026

    @maflcko
    Member

    An alternative could be to set IP_PORTRANGE_HIGH, but I don't know how to do this on freebsd.

  4. hebasto commented on Jan 19, 2026

    @hebasto
    MemberAuthor
  5. w0xlt commented on Jan 19, 2026

    @w0xlt
    Contributor

    A suggestion: #34336

  6. vasild commented on Jan 19, 2026

    @vasild
    Contributor

    Is it correct that the failing test p2p_fingerprint.py (ran as 386/456) is not using port=0 which was introduced in #34186?

    So, it is probably because feature_proxy.py (280/456) ran before it and used port 11756 and left it in TIME_WAIT state (p2p_private_broadcast.py was 398/456 and feature_anchors.py was 425/456, after the failure of p2p_fingerprint.py), right?

  7. maflcko commented on Jan 19, 2026

    @maflcko
    Member

    So, it is probably because feature_proxy.py (280/456) ran before it and used port 11756 and left it in TIME_WAIT state (p2p_private_broadcast.py was 398/456 and feature_anchors.py was 425/456, after the failure of p2p_fingerprint.py), right?

    Ah, good observation. I'd presume that the port was still in use, but it being in TIME_WAIT sounds plausible.

    root# sysctl net.inet.ip.portrange.first=32768

    Setting TEST_RUNNER_PORT_MIN=2000 ...

    I think if this only affects freebsd, and all freebsd people are fine to use one of the workarounds, this seems fine. However, I think ideally the tests work out of the box as-is.

  8. added 2 commits that reference this issue on Jan 19, 2026
    befde74
    01875b1
  9. w0xlt commented on Jan 19, 2026

    @w0xlt
    Contributor

    ideally the tests work out of the box as-is.

    Updated the solution in #34346 to cover IPv6 sockets used by feature_proxy.py.

  10. hebasto commented on Jan 27, 2026

    @hebasto
    MemberAuthor

    Another test resulted in seemingly the same error.

    386/456 - p2p_fingerprint.py failed, Duration: 0 s
    
    stdout:
    2026-01-18T04:34:49.101209Z TestFramework (INFO): PRNG seed is: 4679507874993432966
    2026-01-18T04:34:49.102528Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63
    2026-01-18T04:34:49.360239Z TestFramework (ERROR): Unexpected exception
    Traceback (most recent call last):
      File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 138, in main
        self.setup()
      File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 269, in setup
        self.setup_network()
      File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 360, in setup_network
        self.setup_nodes()
      File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 382, in setup_nodes
        self.start_nodes()
      File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 528, in start_nodes
        node.wait_for_rpc_connection()
      File "/home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_node.py", line 316, in wait_for_rpc_connection
        raise FailedToStartError(self._node_msg(
    test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization. Error: Unable to bind to 127.0.0.1:11756 on this computer. Bitcoin Core is probably already running.
    Error: Failed to listen on any port. Use -listen=0 if you want this.
    ************************
    
    2026-01-18T04:34:49.423831Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
    2026-01-18T04:34:49.424142Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63
    2026-01-18T04:34:49.424336Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63/test_framework.log
    2026-01-18T04:34:49.424671Z TestFramework (ERROR): 
    2026-01-18T04:34:49.425017Z TestFramework (ERROR): Hint: Call /home/runner/work/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20260118_042715/p2p_fingerprint_63' to consolidate all logs
    2026-01-18T04:34:49.425220Z TestFramework (ERROR): 
    2026-01-18T04:34:49.425516Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
    2026-01-18T04:34:49.425685Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
    2026-01-18T04:34:49.425795Z TestFramework (ERROR): 
    
    
    
  11. w0xlt commented on Jan 27, 2026

    @w0xlt
    Contributor

    With or without #34346 ?

  12. hebasto commented on Jan 27, 2026

    @hebasto
    MemberAuthor

    With or without #34346 ?

    The master branch.

  13. deleted a comment from Heiwabit on Jan 28, 2026
  14. added a commit that references this issue on Jan 29, 2026
  15. added 2 commits that reference this issue on Jun 28, 2026
    a4eeb77
    c091610
  16. added 2 commits that reference this issue on Jun 30, 2026
    911bd42
    e7eab50
  17. added 2 commits that reference this issue on Aug 19, 2026
    499932f
    c4c8839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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