Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicast Receive Broken On Windows 10 #5656

Open
j2man opened this Issue Mar 18, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@j2man
Copy link

j2man commented Mar 18, 2019

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]

Windows 10 Enterprise 64-bit
RAM 32g
4 Ethernet Adapters

Expected Behavior

JRuby should be receiving multicast data just like ruby receives multicast data.
Verified data is received properly using ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]

Actual Behavior

JRuby does not receive multicast data.

JRuby multicast send works fine verified with wireshark and vanilla Ruby

################## 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]).hton
sock = UDPSocket.new
sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ip)
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])

@j2man

This comment has been minimized.

Copy link
Author

j2man commented Mar 18, 2019

FYI I verified the bug still exists with the latest version of JRuby 9.2.6.0 poor logstash has no solution even if they bundle the latest release of JRuby.

enebo added a commit that referenced this issue Apr 8, 2019

Merge pull request #5678 from jruby/recvfrom_multicast
multicast receive broken everywhere

Windows is able to bind and sendmsg but the server seems unable to recieve it (blocking by the looks of it).  Looking online and many people have issues getting multicast to work on windows.  It can be from virtual network adapters, firewall settings, address ranges, and no doubt other things.  So I am not positive this is not working based on that but until I can figure out more we can say this fixes all platforms but windows.  Even then I feel like it might work since this is pretty ordinary Java.  

As a result I am leaving windows issue open #5656 but I will be resolving #5657.
@enebo

This comment has been minimized.

Copy link
Member

enebo commented Apr 8, 2019

#5678 may or may not have solved this but since I am unable to not get the test to hang I am going with the assumption it is a problem of ours and not an environment issue.

@j2man can you confirm older versions of JRuby ever passed on windows? I want to make it work but if we knew it worked in a particular version we could go back and see if there was something significant in the older impl.

@j2man

This comment has been minimized.

Copy link
Author

j2man commented Apr 8, 2019

@enebo

For Windows 10:
Logstash 5.5.1 ships with:
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]

I have verified that it works in the 1.7.25 release just fine on windows 10 using Logstash 5.5.1. That is to say I was using the JRuby from the logstash directory.

@enebo enebo added this to the JRuby 9.2.8.0 milestone Apr 9, 2019

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Apr 9, 2019

@j2man ah great. So when I work on this next (two big confs so it will be early may but I targetted 9.2.8.0) I will make sure 1.7.25 works on my machine and then examine how the impl used to look if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.