mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-socket: add temporary getaddrinfo diagnostic for Windows CI
Addrinfo.getaddrinfo("localhost", 53, AF_INET, SOCK_STREAM) crashes
on GitHub Actions Windows runners with WSAHOST_NOT_FOUND, while the
same call works on Linux and macOS. Earlier hypotheses (winsock link
missing; hosts file not populated) have been ruled out on CI.
Probe five variants in one run to isolate the failing condition:
numeric literal 127.0.0.1, localhost with AF_UNSPEC, localhost with
nil family, localhost with AF_INET6, and the original AF_INET path.
Results go to stdout via puts so they are visible in CI logs. This
commit is temporary and will be reverted once the real fix lands.
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,27 @@ assert('super class of Addrinfo') do
|
|||||||
assert_equal(Object, Addrinfo.superclass)
|
assert_equal(Object, Addrinfo.superclass)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TEMPORARY DIAGNOSTIC: observe which getaddrinfo pattern works on Windows CI.
|
||||||
|
# Remove once the root cause is identified and the real fix is in place.
|
||||||
|
assert('Addrinfo.getaddrinfo diagnostic') do
|
||||||
|
cases = [
|
||||||
|
['127.0.0.1 literal AF_INET', -> { Addrinfo.getaddrinfo('127.0.0.1', 53, Socket::AF_INET, Socket::SOCK_STREAM) }],
|
||||||
|
['localhost AF_UNSPEC', -> { Addrinfo.getaddrinfo('localhost', 53, Socket::AF_UNSPEC, Socket::SOCK_STREAM) }],
|
||||||
|
['localhost nil family', -> { Addrinfo.getaddrinfo('localhost', 53) }],
|
||||||
|
['localhost AF_INET6', -> { Addrinfo.getaddrinfo('localhost', 53, Socket::AF_INET6, Socket::SOCK_STREAM) }],
|
||||||
|
['localhost AF_INET (orig)', -> { Addrinfo.getaddrinfo('localhost', 53, Socket::AF_INET, Socket::SOCK_STREAM) }],
|
||||||
|
]
|
||||||
|
cases.each do |label, probe|
|
||||||
|
begin
|
||||||
|
ary = probe.call
|
||||||
|
puts "DIAG #{label}: OK size=#{ary.size} first=#{ary.first&.ip_address.inspect}"
|
||||||
|
rescue => e
|
||||||
|
puts "DIAG #{label}: #{e.class} #{e.message}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert_true(true)
|
||||||
|
end
|
||||||
|
|
||||||
assert('Addrinfo.getaddrinfo') do
|
assert('Addrinfo.getaddrinfo') do
|
||||||
ary = Addrinfo.getaddrinfo("localhost", 53, Socket::AF_INET, Socket::SOCK_STREAM)
|
ary = Addrinfo.getaddrinfo("localhost", 53, Socket::AF_INET, Socket::SOCK_STREAM)
|
||||||
assert_true(ary.size >= 1)
|
assert_true(ary.size >= 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user