Skip to content

db/downloader: keep the BT discovery tests off UDP - #23204

Merged
AskAlexSharov merged 2 commits into
mainfrom
alex/win_test_flakes_37
Aug 12, 2026
Merged

db/downloader: keep the BT discovery tests off UDP#23204
AskAlexSharov merged 2 commits into
mainfrom
alex/win_test_flakes_37

Conversation

@AskAlexSharov

Copy link
Copy Markdown
Collaborator

TestBTPeerDiscovery_AddPeersFromENR fails intermittently on the windows-2025 runner:

--- FAIL: TestBTPeerDiscovery_AddPeersFromENR (0.21s)
    bt_peer_discovery_test.go:49: Received unexpected error:
      subsequent listen: listen udp4 :63198: bind: An attempt was made to access
      a socket in a way forbidden by its access permissions.

torrent.NewClient binds the dynamic port the TCP listener was given on UDP as well, for uTP. Windows reserves UDP port ranges, so that second bind can return WSAEACCES; the library retries with fresh ports up to listenAllRetryLimit and then fails NewClient outright.

The tests never needed uTP — peers are injected by TCP address and DHT is already off. Setting DisableUTP (with the NoDHT these configs already set) drops the UDP listeners:

DisableUTP=false → tcp 0.0.0.0:50611, tcp [::]:50611, udp 0.0.0.0:50611, udp [::]:50611
DisableUTP=true  → tcp 0.0.0.0:50614, tcp [::]:50614

The three client configs in the file now go through one helper so a future test cannot reintroduce the UDP bind.

go test ./db/downloader/ -run TestBTPeerDiscovery -count=3 passes.

Not fixed here: the same windows job also failed TestRecordPreload_RecordsElapsedAndBytes (execution/commitment), which is unrelated — a float64 cancellation on a shared counter, not a port problem.

torrent.NewClient binds the dynamic port it got for TCP on UDP as well, for
uTP. Windows runners reserve UDP port ranges, so that second bind can fail
with WSAEACCES and take NewClient down with it once the library exhausts its
listen retries. The tests inject peers by TCP address and already run without
DHT, so uTP was never used.

Route the three client configs through one helper that disables uTP along
with DHT and trackers.
@AskAlexSharov
AskAlexSharov added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit fc4be5c Aug 12, 2026
134 checks passed
@AskAlexSharov
AskAlexSharov deleted the alex/win_test_flakes_37 branch August 12, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants