The SecondaryForwarder zone transfer test picks a port that is free for both TCP and UDP #382

Merged
claude merged 2 commits from feature/374-secondary-forwarder-windows into develop 2026-11-12 06:07:35 -05:00
Owner

The SecondaryForwarder zone transfer test no longer times out on Windows. Test code only; no product change.

  • Failure: TheSecondaryForwarderZonePullsAndDecodesTheExactConfiguredAddressListInOrder timed out in three of four develop runs on the Windows runner ("Last observed: []").
  • Cause, reproduced on lofnheim: the test reserved a port for TCP only and waited only for the primary's TCP listener. A pull starts with a UDP SOA query to the same port number. Windows keeps separate excluded port ranges per protocol, so the number can be refused for UDP: the primary logged Plain DNS (UDP) could not listen on :: port 55606: SocketException (10013), kept serving TCP, and the secondary logged "No usable SOA answer" until the test's 20 s wait ran out.
  • Fix: the test picks a random port in the dynamic range and binds TCP and UDP on it through dual-stack wildcard sockets (up to 2000 picks), as the transport tests do, and waits for both listeners of the primary. A listener that reports a failed bind restarts the primary on a new port, a bounded number of times.
  • Found on the way: a secondary never transfers from a primary that answers only over the transfer transport, because the SOA check is UDP-only. That is a design question, filed as #380.

Verified

  • lofnheim, this head: the test class 10 of 10, the whole Ninlil.Dns.Server.Authoritative.Tests project 671 of 671.
  • lofnheim, first commit: the test 20 of 20 alone and 10 of 10 under CPU load; unfixed it failed 2 of 10 under that load. No test fails on demand before the fix.
  • Linux: the project 671 of 671; the class three times. The build has 0 warnings and csharpier is clean.
  • The verifier accepted the first commit with three findings on the port search and accepted the second commit as resolving them.

Closes #374

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

The SecondaryForwarder zone transfer test no longer times out on Windows. Test code only; no product change. - **Failure:** `TheSecondaryForwarderZonePullsAndDecodesTheExactConfiguredAddressListInOrder` timed out in three of four `develop` runs on the Windows runner ("Last observed: []"). - **Cause, reproduced on lofnheim:** the test reserved a port for TCP only and waited only for the primary's TCP listener. A pull starts with a UDP SOA query to the same port number. Windows keeps separate excluded port ranges per protocol, so the number can be refused for UDP: the primary logged `Plain DNS (UDP) could not listen on :: port 55606: SocketException (10013)`, kept serving TCP, and the secondary logged "No usable SOA answer" until the test's 20 s wait ran out. - **Fix:** the test picks a random port in the dynamic range and binds TCP and UDP on it through dual-stack wildcard sockets (up to 2000 picks), as the transport tests do, and waits for both listeners of the primary. A listener that reports a failed bind restarts the primary on a new port, a bounded number of times. - **Found on the way:** a secondary never transfers from a primary that answers only over the transfer transport, because the SOA check is UDP-only. That is a design question, filed as #380. **Verified** - lofnheim, this head: the test class 10 of 10, the whole `Ninlil.Dns.Server.Authoritative.Tests` project 671 of 671. - lofnheim, first commit: the test 20 of 20 alone and 10 of 10 under CPU load; unfixed it failed 2 of 10 under that load. No test fails on demand before the fix. - Linux: the project 671 of 671; the class three times. The build has 0 warnings and csharpier is clean. - The verifier accepted the first commit with three findings on the port search and accepted the second commit as resolving them. Closes #374 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The SOA check of a pull is a UDP query to the same port number as the TCP transfer. The test reserved a TCP-only port, and on Windows the UDP port exclusion ranges differ from the TCP ones, so the primary's UDP listener could fail to bind (error 10013) and every pull went unanswered.

Closes #374

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
The secondary forwarder zone transfer tests search for a free port by random dual-stack picks
Some checks failed
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Successful in -1m44s
Build / Pack and Push NuGet Packages (common) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Successful in -1m49s
Build / Pack and Push NuGet Packages (dhcp) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Successful in -1m54s
Build / Stage Draft Release (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (push) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Successful in -17s
Build / Build Binary (macos-amd64) (pull_request) Successful in -34s
Build / Build Binary (linux-amd64) (push) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Successful in -33s
Build / Build Binary (macos-arm64) (pull_request) Successful in -47s
Build / Build Binary (linux-arm64) (push) Has been skipped
Build / Smoke Test the Windows Binary (push) Has been skipped
Build / Build Binary (macos-amd64) (push) Has been skipped
Build / Build Binary (windows-amd64) (push) Has been skipped
Build / Build Binary (macos-arm64) (push) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Successful in -1m6s
Build / Smoke Test the Windows Binary (pull_request) Successful in 16s
Build / Build and Test Deb and RPM Packages (push) Has been skipped
Build / Build Arch Linux Packages (push) Has been skipped
Build / Build and Push Image (push) Has been skipped
Build / Build Arch Linux Packages (pull_request) Successful in -2m15s
Build / Pipeline (push) Failing after 0s
Build / Build and Push Image (pull_request) Successful in -2m16s
Build / Publish Release (push) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Successful in 16s
Build / Publish Release (pull_request) Successful in -2m34s
Build / Pipeline (pull_request) Successful in 0s
5ed4287c7d
A search that follows the Windows port-0 counter is refused for a whole UDP-excluded block, so the test picks random ports from the dynamic range and probes them with the dual-stack wildcard sockets the listeners bind.

Refs #374

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 4695687e5c into develop 2026-11-12 06:07:35 -05:00
claude deleted branch feature/374-secondary-forwarder-windows 2026-11-12 06:07:35 -05:00
Sign in to join this conversation.
No reviewers
No milestone
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!382
No description provided.