-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Environment
Logstash 6.6.2 Bundled JRuby
jruby 9.1.13.0 (2.3.3) 2017-09-06 8e1c115 Java HotSpot(TM) 64-Bit Server VM 25.162-b12 on 1.8.0_162-b12 +jit [mswin32-x86_64]
Running on:
Red Hat Enterprise Linux Workstation 7.5 (Maipo)
Expected Behavior
Call to recvfrom should not generate a socket error.
Actual Behavior
SocketError: No message available
block in ./udprcv.rb at ./udprcv.rb:14
loop at org/jruby/RubyKernel.java:1292
Broken in:
jruby 9.1.13.0 (2.3.3) 2017-09-06 8e1c115 OpenJDK 64-Bit Server VM 25.181-b13 on 1.8.0_181-b13 +jit [linux-x86_64]
Verified that it works in this release just fine:
jruby 1.7.25 (1.9.3p551) 2016-04-13 867cb81 on OpenJDK 64-Bit Server VM 1.8.0_181-b13 +jit [linux-amd64]
Something is broken.
################## Rx Code
require 'socket'
require 'ipaddr'
MCAST_GROUP = {
:addr => '225.4.5.6',
:port => 12345,
:bindaddr => '0.0.0.0'
}
ip = IPAddr.new(MCAST_GROUP[:addr]).hton + IPAddr.new(MCAST_GROUP[:bindaddr]).h
ton
sock = UDPSocket.new
sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ip)
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEPORT, 1)
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1)
sock.bind(Socket::INADDR_ANY, MCAST_GROUP[:port])
loop do
msg, info = sock.recvfrom(1024)
puts "MSG: #{msg} from #{info[2]} (#{info[3]})/#{info[1]} len #{msg.size}"
end
################## Tx Code
require 'socket'
MCAST_GROUP = {
:addr => '225.4.5.6',
:port => 12345,
}
s = UDPSocket.new
s.setsockopt(Socket::IPPROTO_IP, Socket::IP_MULTICAST_TTL, 1)
s.send("hello", 0, MCAST_GROUP[:addr], MCAST_GROUP[:port])