Fix flaky dokodemo scenario tests by reserving the whole configured port range - #3797
Fix flaky dokodemo scenario tests by reserving the whole configured port range#3797Loyalsoldier with Copilot wants to merge 7 commits into
Conversation
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
…VMessGCMMuxUDP Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
…ial deadlock in httpupgrade Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3797 +/- ##
==========================================
+ Coverage 24.93% 25.16% +0.22%
==========================================
Files 916 916
Lines 57820 57887 +67
==========================================
+ Hits 14418 14565 +147
+ Misses 41557 41444 -113
- Partials 1845 1878 +33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@copilot Review this PR, summarize it based on code changes. Change the title and summary of this PR. |
Reviewed the full branch diff (7 commits, New title: Fix httpupgrade early data corruption and stabilize flaky scenario tests What the code actually changesProduction fixes —
Test-only changes
New coverage: Review notesNo blocking issues found. Checks worth recording: the dokodemo TCP test is TCP-only ( Verified locally: One caveat worth flagging: this branch now mixes production transport fixes with test stabilization. I can split the |
…ization Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
go test ./testing/scenarios/fails intermittently. Repeated runs reproduceTestDokodemoTCPfailing with sixdial tcp 127.0.0.1:355xx: connect: connection refusederrors, while the child v2ray process had actually died at startup:Root cause
Both dokodemo tests reserve one port but configure the inbound to listen on six:
PickPort()returns a port from the OS ephemeral range (32768–60999 on Linux), so under the port pressure the rest of the suite generates, one of the five unverified ports is frequently already bound. A single conflict aborts the entire child v2ray instance, so every dial in the test reportsconnection refused— which is why the failure never looked port-related. It also explains why-run TestDokodemoin isolation never reproduces it; the collision needs the ephemeral-port pressure from the full suite.Changes
testing/servers/{tcp,udp}/port.go— newPickPortRange(count int) net.Port. It picks a base port, then binds allcountconsecutive ports simultaneously so the whole block is proven free before any listener is released; retries up to 100 times and bounds the range to 65535.testing/scenarios/dokodemo_test.go—TestDokodemoTCPandTestDokodemoUDPnow reserve the range they actually configure:Changes are confined to test helpers and test files; no production code is touched.
Verification
A/B under an identical synthetic load of 8000 held ephemeral ports: 9/10 runs failed before, 0/10 after.