Skip to content

Six identify/host/quic tests fail under full-suite pytest-xdist load #1377

Description

@acul71

Problem

Running the full test suite in parallel fails six integration tests consistently on current main (7acf896e and later), while ad1eb6ae passes cleanly (3061 tests).

Failures appear when running:

make pr          # includes: python -m pytest tests -n auto
python -m pytest tests -n auto -q

The same six tests pass in isolation (even with -n auto).

Affected tests

  1. tests/core/identity/identify/test_identify_integration.py::test_identify_multi_transport_host_addresses — address not advertised in listen_addrs
  2. tests/core/identity/identify/test_identify_integration.py::test_identify_protocol_varint_format_integrationlisten_addrs == []
  3. tests/core/identity/identify/test_identify_integration.py::test_identify_protocol_raw_format_integrationlisten_addrs == []
  4. tests/core/identity/identify/test_identify.py::test_identify_protocolValueError: Could not deserialize key data (truncated signedPeerRecord)
  5. tests/core/test_libp2p/test_libp2p.py::test_host_connect — advertised addr not in peerstore
  6. tests/core/transport/quic/test_integration.py::test_yamux_stress_ping — automatic identify did not cache ping within 5s

Reproduction

# Full suite — fails on main (6 failures, ~3059 passed)
python -m pytest tests -n auto -q

# Isolated — passes
python -m pytest tests/core/identity/identify/test_identify.py::test_identify_protocol -n auto -q

Root cause

Load-sensitive timing races in identify / address propagation under pytest-xdist full-suite parallel execution:

  • Identify handler sometimes runs before listen addresses are visible (listen_addrs == [])
  • Background identify lags behind test assertions on peerstore addresses
  • Occasional truncated identify responses under CPU contention

This is not caused by #1372 (interop IPv6) or #1374 (QUIC mypy) logic changes. #1372 added 3 interop tests and shifted xdist scheduling, surfacing latent races that were not visible on ad1eb6ae.

Expected fix

  • Harden identify handler to wait for listen addresses and fall back to transport addrs
  • Add test synchronization (framed reads, _identify_peer waits)
  • Mark load-sensitive tests with @pytest.mark.serial_only and split make test into parallel + serial phases

Environment

  • Linux x86_64, 32 CPUs, Python 3.13.11
  • ulimit -n 100000
  • Investigation log: downloads/PARALLEL-TEST-FAILURES/INVESTIGATION.md (on fix branch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions