Summary
test_no_delay (in tests/test_connection.py) is failing intermittently across multiple CI configurations (ASan/UBSan, Full Integration, etc.), including on retries.
Root Cause
Commit 91c8c37 ("fix nagle time delay for macOS-Issue #9064") introduced an adaptive probe: 10 round-trips are timed with Nagle enabled and without, and the per-RTT difference is used to compute expected_saving, which then gates the assertion for the full 100-trip run.
The 10-sample probe has high variance and consistently overestimates the per-RTT Nagle delay by ~2x relative to the full run. When the probe overestimates, expected_saving is set too high and the assertion fails even though Nagle disabling is clearly working.
Failing assertions from CI
# assert normal_time < nagle_time - expected_saving
assert 21.80726671218872 < (28.225794553756714 - 7.359144687652589)
assert 25.825435400009155 < (31.75627374649048 - 6.155816316604614)
assert 14.281448602676392 < (22.333508729934692 - 9.02500867843628)
All three cases show a real, clear saving (19-36%) — the test is just asserting too aggressively based on the noisy probe.
Example failing runs
Fix
Halve the required saving in the strict-check branch (expected_saving / 2 instead of expected_saving). This gives a 4x total discount from the raw probe estimate (2x already baked in for Nagle average, 2x more for probe noise), while still catching a real regression where TCP_NODELAY is not set.
Summary
test_no_delay(intests/test_connection.py) is failing intermittently across multiple CI configurations (ASan/UBSan, Full Integration, etc.), including on retries.Root Cause
Commit 91c8c37 ("fix nagle time delay for macOS-Issue #9064") introduced an adaptive probe: 10 round-trips are timed with Nagle enabled and without, and the per-RTT difference is used to compute
expected_saving, which then gates the assertion for the full 100-trip run.The 10-sample probe has high variance and consistently overestimates the per-RTT Nagle delay by ~2x relative to the full run. When the probe overestimates,
expected_savingis set too high and the assertion fails even though Nagle disabling is clearly working.Failing assertions from CI
All three cases show a real, clear saving (19-36%) — the test is just asserting too aggressively based on the noisy probe.
Example failing runs
Fix
Halve the required saving in the strict-check branch (
expected_saving / 2instead ofexpected_saving). This gives a 4x total discount from the raw probe estimate (2x already baked in for Nagle average, 2x more for probe noise), while still catching a real regression whereTCP_NODELAYis not set.