Issue #20403 has been updated by kjtsanaktsidis (KJ Tsanaktsidis).
I opened
https://github.com/ruby/ruby/pull/10413 for this.
----------------------------------------
Bug #20403: TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback can flake if TCP
port is in use
https://bugs.ruby-lang.org/issues/20403#change-107550
* Author: kjtsanaktsidis (KJ Tsanaktsidis)
* Status: Open
* Assignee: kjtsanaktsidis (KJ Tsanaktsidis)
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The test TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback wants to make a TCP
and UDP DNS server on the same port. It achieves this by binding to a random UDP port
(with `:0`), and then trying to bind to that TCP port. However, just because the UDP port
was free, does not mean the TCP port was, so this can fail.
This leads to test failures like this one:
https://github.com/ruby/ruby/actions/runs/8497267556/job/23275642160
```
1) Error:
TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback:
Errno::EACCES: Permission denied - bind(2) for "127.0.0.1" port 49701
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:48:in 'TCPServer#initialize'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:48:in 'IO.new'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:48:in 'TestResolvDNS#with_tcp'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:181:in 'block in
TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:61:in 'TestResolvDNS#with_udp'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:179:in
'TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback'
Finished tests in 401.425882s, 64.4851 tests/s, 15534.2649 assertions/s.
25886 tests, 6235856 assertions, 0 failures, 1 errors, 502 skips
```
(note - it's EACCESS, not EADDRINUSE, because of this issue on Windows, I think:
https://stackoverflow.com/questions/48478869/cannot-bind-to-some-ports-due-…)
--
https://bugs.ruby-lang.org/