Skip to content

Commit eb80511

Browse files
authored
test/socket: rescue Errno::ENOBUFS in test_udp_server (ruby#16553)
The server thread's msg_src.reply can raise Errno::ENOBUFS ("No buffer space available") transiently on macOS CI. This exception was not caught, propagating through th.join in the ensure block and failing the test. Rescue it in the server thread so the client side times out on IO.select, raises RuntimeError, and hits the existing omit path.
1 parent 166f434 commit eb80511

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/socket/test_socket.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,16 @@ def test_udp_server
418418

419419
ping_p = false
420420
th = Thread.new {
421-
Socket.udp_server_loop_on(sockets) {|msg, msg_src|
422-
break if msg == "exit"
423-
rmsg = Marshal.dump([msg, msg_src.remote_address, msg_src.local_address])
424-
ping_p = true
425-
msg_src.reply rmsg
426-
}
421+
begin
422+
Socket.udp_server_loop_on(sockets) {|msg, msg_src|
423+
break if msg == "exit"
424+
rmsg = Marshal.dump([msg, msg_src.remote_address, msg_src.local_address])
425+
ping_p = true
426+
msg_src.reply rmsg
427+
}
428+
rescue Errno::ENOBUFS
429+
# transient OS error on macOS CI, let client timeout and omit
430+
end
427431
}
428432

429433
ifaddrs.each {|ifa|

0 commit comments

Comments
 (0)