[Bug #1146] TestSocket#test_udp_server hangs when configure --with-lookup-order-hack=INET


#1

Bug #1146: TestSocket#test_udp_server hangs when configure
–with-lookup-order-hack=INET
http://redmine.ruby-lang.org/issues/show/1146

e$B5/I<<Te(B: Kazuhiro NISHIYAMA
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.9.2dev (2009-02-12 trunk 22247) [i686-linux]

configuree$B$N$H$-$Ke(B–with-lookup-order-hack=INETe$B$r$D$1$F$$$k$He(B
Socket.udp_server_sockets(0) {|sockets| … } e$B$Ge(B sockets e$B$Ke(B
IPv6e$B$GBT$A<u$1$F$$$J$$$N$K!“e(BSocket.ip_address_list e$B$K$Oe(B IPv6
e$B$Ne(B
e$B%”%I%l%9$,$"$k$N$G!"e(BIPv6e$B$G$Ne(Bsendmsge$B$G;_$^$C$F$7$^$&$h$&$G$9!#e(B

e$B0J2<$N$h$&$K$7$FD4$Y$F$_$k$He(B “::”
e$B$NM-L5$,$"$k$3$H$,$o$+$j$^$9!#e(B

e$B$^$?!“e(B–with-lookup-order-hack=INET
e$B$”$j$G;_$^$C$F$7$^$&$H$-$Ke(B
Ctrl+C e$B$re(B2e$B2s2!$5$J$$$HH?1~$,$"$j$^$;$s$G$7$?!#e(B

Index: test/socket/test_socket.rb

— test/socket/test_socket.rb (revision 22249)
+++ test/socket/test_socket.rb (working copy)
@@ -233,6 +233,7 @@ class TestSocket < Test::Unit::TestCase
end

 Socket.udp_server_sockets(0) {|sockets|

+p sockets.map{|ai| ai.local_address.ip_address } -
ip_addrs.map(&:ip_address)
begin
port = sockets.first.local_address.ip_port

–with-lookup-order-hack=INET e$B$J$7e(B:
% /tmp/r/bin/ruby -v ~/wc/ruby/trunk/test/socket/test_socket.rb -v
ruby 1.9.2dev (2009-02-12 trunk 22247) [i686-linux]
Loaded suite /home/kazu/wc/ruby/trunk/test/socket/test_socket
Started
TestSocket#test_accept_loop: 0.00 s: .
TestSocket#test_accept_loop_with_unix: 0.00 s: .
TestSocket#test_getaddrinfo: 0.00 s: .
TestSocket#test_getnameinfo: 0.00 s: .
TestSocket#test_initialize: 0.00 s: .
TestSocket#test_ip_address_list: 0.00 s: .
TestSocket#test_socket_new: 0.00 s: .
TestSocket#test_sysaccept: 0.00 s: .
TestSocket#test_tcp: 0.00 s: .
TestSocket#test_tcp_server_sockets: 0.00 s: .
TestSocket#test_tcp_server_sockets_port0: 0.00 s: .
TestSocket#test_udp_server: ["::"]
0.01 s: .
TestSocket#test_unix: 0.00 s: .
TestSocket#test_unix_server_socket: 0.00 s: .
TestSocket#test_unpack_sockaddr: 0.00 s: .

Finished in 0.042818 seconds.

15 tests, 68 assertions, 0 failures, 0 errors, 0 skips
%

–with-lookup-order-hack=INET e$B$"$je(B:
% /tmp/r2/bin/ruby -v ~/wc/ruby/trunk/test/socket/test_socket.rb -v
ruby 1.9.2dev (2009-02-12 trunk 22247) [i686-linux]
Loaded suite /home/kazu/wc/ruby/trunk/test/socket/test_socket
Started
TestSocket#test_accept_loop: 0.00 s: .
TestSocket#test_accept_loop_with_unix: 0.00 s: .
TestSocket#test_getaddrinfo: 0.00 s: .
TestSocket#test_getnameinfo: 0.00 s: .
TestSocket#test_initialize: 0.00 s: .
TestSocket#test_ip_address_list: 0.00 s: .
TestSocket#test_socket_new: 0.00 s: .
TestSocket#test_sysaccept: 0.00 s: .
TestSocket#test_tcp: 0.00 s: .
TestSocket#test_tcp_server_sockets: 0.00 s: .
TestSocket#test_tcp_server_sockets_port0: 0.00 s: .
TestSocket#test_udp_server: []
^C^C1.77 s: E
TestSocket#test_unix: 0.00 s: .
TestSocket#test_unix_server_socket: 0.00 s: .
TestSocket#test_unpack_sockaddr: 0.00 s: .

Finished in 1.780257 seconds.

  1. Error:
    test_udp_server(TestSocket):
    Interrupt:
    /home/kazu/wc/ruby/trunk/test/socket/test_socket.rb:260:in sendmsg' /home/kazu/wc/ruby/trunk/test/socket/test_socket.rb:260:inblock (2
    levels) in test_udp_server’

15 tests, 54 assertions, 0 failures, 1 errors, 0 skips
%


#2

e$B%A%1%C%He(B #1146 e$B$,99?7$5$l$^$7$?!#e(B (by Akira T.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r22260.

http://redmine.ruby-lang.org/issues/show/1146