The Windows test job no longer fails on port and socket errors #375

Closed
opened 2026-11-12 04:13:42 -05:00 by claude · 0 comments
Owner

What happens

The job "Test .NET on Windows" failed on all four develop runs of 2026-11-12, with different tests each time. The runs did not overlap (05:37 to 06:05 UTC, back to back, about 6 minutes each), so two copies of the suite never ran together. Apart from the SecondaryForwarder zone test (its own issue), the failures are socket and port errors:

Run Failed Classes Errors
1450 9 DnsCryptDiscoveryLimitTests (6), DnsCryptListenAddressTests, DnsCryptProviderNameTests, DnsOverTlsListenerTests InvalidOperationException: Could not find a port free for both UDP and TCP. (9 times; Fakes/LocalAddresses.GetFreePort, 20 attempts each)
1451 3 PlainForwarderClientTests SocketException: An attempt was made to access a socket in a way forbidden by its access permissions
1454 15 DnsCryptListenerTests (13), PlainListenAddressTests, StubZoneNsPullerTests No connection could be made because the target machine actively refused it (6), An existing connection was forcibly closed by the remote host (5), and assertion failures that follow from them

What is known

  • All of these classes get their ports from a reserve-and-release helper (LocalAddresses.GetFreePort and its siblings): bind, read the port, close, bind again later.
  • lofnheim has Windows port exclusion ranges inside the dynamic range 49152 to 65535: about 600 TCP ports in six 100-port blocks, and about 660 UDP ports in other blocks (netsh int ipv4 show excludedportrange protocol=tcp|udp). A port the system hands out for UDP can therefore be forbidden for TCP and the reverse; binding it fails with WSAEACCES, the "forbidden by its access permissions" error. The blocks move at boot.
  • The exclusions alone do not explain 20 failed attempts in a row nine times in one run. Something else makes the TCP bind fail repeatedly; not known yet.
  • The suite ran four times back to back. Whether sockets or ports left by one run hurt the next is not known.

Wanted

  • Find the cause of each error class on lofnheim, with evidence, and fix it at the cause.
  • Where a test can bind port 0 and read the bound port, convert it (AGENTS.md, "Test"). Where several sockets must share one number, the helper must cope with Windows exclusion ranges and say why in a comment.
  • If the cause is in product code (for example a listener that reports ready before it is bound, or a socket option that behaves differently on Windows), fix the product code and add a test.

Acceptance

  • The whole Windows suite, as the job runs it, passes three times back to back on lofnheim.
  • The Linux test job stays green.
## What happens The job "Test .NET on Windows" failed on all four `develop` runs of 2026-11-12, with different tests each time. The runs did not overlap (05:37 to 06:05 UTC, back to back, about 6 minutes each), so two copies of the suite never ran together. Apart from the SecondaryForwarder zone test (its own issue), the failures are socket and port errors: | Run | Failed | Classes | Errors | |---|---|---|---| | 1450 | 9 | `DnsCryptDiscoveryLimitTests` (6), `DnsCryptListenAddressTests`, `DnsCryptProviderNameTests`, `DnsOverTlsListenerTests` | `InvalidOperationException: Could not find a port free for both UDP and TCP.` (9 times; `Fakes/LocalAddresses.GetFreePort`, 20 attempts each) | | 1451 | 3 | `PlainForwarderClientTests` | `SocketException: An attempt was made to access a socket in a way forbidden by its access permissions` | | 1454 | 15 | `DnsCryptListenerTests` (13), `PlainListenAddressTests`, `StubZoneNsPullerTests` | `No connection could be made because the target machine actively refused it` (6), `An existing connection was forcibly closed by the remote host` (5), and assertion failures that follow from them | ## What is known - All of these classes get their ports from a reserve-and-release helper (`LocalAddresses.GetFreePort` and its siblings): bind, read the port, close, bind again later. - lofnheim has Windows port exclusion ranges inside the dynamic range 49152 to 65535: about 600 TCP ports in six 100-port blocks, and about 660 UDP ports in other blocks (`netsh int ipv4 show excludedportrange protocol=tcp|udp`). A port the system hands out for UDP can therefore be forbidden for TCP and the reverse; binding it fails with WSAEACCES, the "forbidden by its access permissions" error. The blocks move at boot. - The exclusions alone do not explain 20 failed attempts in a row nine times in one run. Something else makes the TCP bind fail repeatedly; not known yet. - The suite ran four times back to back. Whether sockets or ports left by one run hurt the next is not known. ## Wanted - Find the cause of each error class on lofnheim, with evidence, and fix it at the cause. - Where a test can bind port 0 and read the bound port, convert it (AGENTS.md, "Test"). Where several sockets must share one number, the helper must cope with Windows exclusion ranges and say why in a comment. - If the cause is in product code (for example a listener that reports ready before it is bound, or a socket option that behaves differently on Windows), fix the product code and add a test. ## Acceptance - The whole Windows suite, as the job runs it, passes three times back to back on lofnheim. - The Linux test job stays green.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#375
No description provided.