-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
UDPSocket.new(Socket::AF_INET6) throws exception (JRuby 9.1.14.0) #4869
Comments
This reverts commit d38e4ff. (Original commit was part of #8620) The revert is due to `UDPSocket.new(Socket::AF_INET)` crashing in 9.1.14.0: * #8736 * jruby/jruby#4869
This reverts commit d38e4ff. (Original commit was part of #8620) The revert is due to `UDPSocket.new(Socket::AF_INET)` crashing in 9.1.14.0: * #8736 * jruby/jruby#4869 Fixes #8738
This reverts commit d38e4ff. (Original commit was part of #8620) The revert is due to `UDPSocket.new(Socket::AF_INET)` crashing in 9.1.14.0: * #8736 * jruby/jruby#4869 Fixes #8738
This reverts commit d38e4ff. (Original commit was part of #8620) The revert is due to `UDPSocket.new(Socket::AF_INET)` crashing in 9.1.14.0: * #8736 * jruby/jruby#4869 Fixes #8738
This error appears to be coming from the JDK. Does IPv6 UDP work from Java? |
The JDK lines are pretty straightforward...seems like IPv6 is just not available. But you say it works in 9.1.13, so that's very confusing. We should handle that error better, obviously. I'll fix that now. No theories as to why IPv6 suddenly is unavailable in 9.1.14.0 :-( It really doesn't seem like something we could do. |
Ok, I can reproduce it if I tell the JDK to prefer IPv4. Perhaps you are setting this in some environment, or otherwise unsetting it for 9.1.13? (This is with the new error)
|
FWIW I did not find this property in either our bash script or or native launcher. It might be getting set in some CI environments to avoid issues with IPv4/IPv6 address resolution (JDK tended to prefer IPv6 for binding while MRI preferred IPv4). |
Nothing I can tell -- I am using rbenv, and from the same shell:
If I throw in a sleep so I can check the java args with jps
For easier viewing, here's a diff of the arguments (sorted): --- /tmp/jps.13 2017-11-27 19:59:58.496754680 -0800
+++ /tmp/jps.14 2017-11-27 20:00:01.386075726 -0800
@@ -1,9 +1,10 @@
+-Djava.security.egd=file:/dev/urandom
-Djdk.home=
--Djffi.boot.library.path=/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/sparcv9-Linux:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/ppc64le-Linux:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/aarch64-Linux:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/x86_64-Linux:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/ppc64-Linux:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/i386-Linux:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jni/arm-Linux
--Djruby.home=/home/jls/.rbenv/versions/jruby-9.1.13.0
+-Djffi.boot.library.path=/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/sparcv9-Linux:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/ppc64le-Linux:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/aarch64-Linux:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/x86_64-Linux:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/ppc64-Linux:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/i386-Linux:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jni/arm-Linux
+-Djruby.home=/home/jls/.rbenv/versions/jruby-9.1.14.0
-Djruby.script=jruby
-Djruby.shell=/bin/sh
Main
--Xbootclasspath/a:/home/jls/.rbenv/versions/jruby-9.1.13.0/lib/jruby.jar
+-Xbootclasspath/a:/home/jls/.rbenv/versions/jruby-9.1.14.0/lib/jruby.jar
-Xmx500m
-Xss2048k |
Fascinating! Inet6 really seems disabled somehow ... strace shows this for the given
|
I'm going to close this since it is clear my system has preferIPv4 enabled, but honestly I have no idea how. If I find the reason and if that reason is mysterious, I'll post it here for posterity, but I don't think this is a JRuby bug at this time. From Java directly, |
I tested on a fresh docker image
|
@jordansissel Of course I should have grepped JRuby source as well. I discovered 691bf16 meant to address #775, and this does indeed attempt to set the related Java property to prefer IPv4. Given this, my current theory is that some library or core change to JRuby in 9.1.14.0 has now allowed this setting to actually take effect when it wasn't before. For example, a newer RubyGems may not need to activate the |
If my theory plays out, then this IPv4-forcing has not been working consistently anyway, and we may as well eliminate the configurable setting. |
haha, this was the last place I expected to find the answer, fwiw. I spent a bit of time chasing down rbenv, fedora global java settings, jdk source code, etc. It was a good adventure for me! :) I can at least confirm that in Java, when preferIPv4Stack=true, UDP on IPV6 fails:
I think your theory makes sense. My gut says that y'all fixed some things in 9.1.14.0 that accidentally enabled this feature that was (for years!) intended to have this effect. Let me know if I can help further. I'm open to sending a patch also, if you want to spread that load. I am also happy to test any patches if I am not authoring. |
It's possible the feature did work originally, but as time went on it became less of a concern. In any case, I think it may be better to just relegate this setting to JAVA_OPTS and remove it from our properties. |
The related networking properties: https://docs.oracle.com/javase/8/docs/api/java/net/doc-files/net-properties.html |
This reverts commit d38e4ff. (Original commit was part of elastic#8620) The revert is due to `UDPSocket.new(Socket::AF_INET)` crashing in 9.1.14.0: * elastic#8736 * jruby/jruby#4869 Fixes elastic#8738
Environment
Provide at least:
uname -a
): Linux xyz 4.13.12-300.fc27.x86_64 break script engine #1 SMP Wed Nov 8 16:38:01 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxThe example reproduction works correctly in JRuby 9.1.13.0
Expected Behavior
Creating a UDPSocket for IPv6 throws a Java exception.
Actual Behavior
The text was updated successfully, but these errors were encountered: