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
tests/core/identity/identify/test_identify_integration.py::test_identify_multi_transport_host_addresses — address not advertised in listen_addrs
tests/core/identity/identify/test_identify_integration.py::test_identify_protocol_varint_format_integration — listen_addrs == []
tests/core/identity/identify/test_identify_integration.py::test_identify_protocol_raw_format_integration — listen_addrs == []
tests/core/identity/identify/test_identify.py::test_identify_protocol — ValueError: Could not deserialize key data (truncated signedPeerRecord)
tests/core/test_libp2p/test_libp2p.py::test_host_connect — advertised addr not in peerstore
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)
Problem
Running the full test suite in parallel fails six integration tests consistently on current
main(7acf896eand later), whilead1eb6aepasses cleanly (3061 tests).Failures appear when running:
make pr # includes: python -m pytest tests -n auto python -m pytest tests -n auto -qThe same six tests pass in isolation (even with
-n auto).Affected tests
tests/core/identity/identify/test_identify_integration.py::test_identify_multi_transport_host_addresses— address not advertised inlisten_addrstests/core/identity/identify/test_identify_integration.py::test_identify_protocol_varint_format_integration—listen_addrs == []tests/core/identity/identify/test_identify_integration.py::test_identify_protocol_raw_format_integration—listen_addrs == []tests/core/identity/identify/test_identify.py::test_identify_protocol—ValueError: Could not deserialize key data(truncatedsignedPeerRecord)tests/core/test_libp2p/test_libp2p.py::test_host_connect— advertised addr not in peerstoretests/core/transport/quic/test_integration.py::test_yamux_stress_ping— automatic identify did not cache ping within 5sReproduction
Root cause
Load-sensitive timing races in identify / address propagation under pytest-xdist full-suite parallel execution:
listen_addrs == [])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
_identify_peerwaits)@pytest.mark.serial_onlyand splitmake testinto parallel + serial phasesEnvironment
ulimit -n100000downloads/PARALLEL-TEST-FAILURES/INVESTIGATION.md(on fix branch)