Skip to content

UDPSocket.new(Socket::AF_INET6) throws exception (JRuby 9.1.14.0) #4869

@jordansissel

Description

@jordansissel

Environment

Provide at least:

  • JRuby version: 9.1.14.0
  • Operating system and platform (e.g. 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/Linux

The example reproduction works correctly in JRuby 9.1.13.0

Expected Behavior

  • Describe your expectation of how JRuby should behave, perhaps by showing how CRuby/MRI behaves.

Creating a UDPSocket for IPv6 throws a Java exception.

  • Provide an executable Ruby script or a link to an example repository.
% ruby --version
jruby 9.1.14.0 (2.3.3) 2017-11-08 2176f24 OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [linux-x86_64]

% ruby -rsocket -e 'UDPSocket.new(Socket::AF_INET6)'
<crashes w/ exception>

Actual Behavior

  • Describe or show the actual behavior.
% ruby -rsocket -e 'UDPSocket.new(Socket::AF_INET6)'
Unhandled Java exception: java.lang.UnsupportedOperationException: IPv6 not available
java.lang.UnsupportedOperationException: IPv6 not available
               <init> at sun/nio/ch/DatagramChannelImpl.java:138
  openDatagramChannel at sun/nio/ch/SelectorProviderImpl.java:46
                 open at java/nio/channels/DatagramChannel.java:182
           initialize at org/jruby/ext/socket/RubyUDPSocket.java:126
           initialize at org/jruby/ext/socket/RubyUDPSocket.java:116
                 call at org/jruby/ext/socket/RubyUDPSocket$INVOKER$i$initialize.gen:-1
                 call at org/jruby/internal/runtime/methods/JavaMethod.java:739
         cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:278
                 call at org/jruby/runtime/callsite/CachingCallSite.java:79
          newInstance at org/jruby/RubyClass.java:1022
          newInstance at org/jruby/RubyIO.java:875
                 call at org/jruby/RubyIO$INVOKER$s$0$0$newInstance.gen:-1
                 call at org/jruby/internal/runtime/methods/DynamicMethod.java:204
                 call at org/jruby/internal/runtime/methods/DynamicMethod.java:200
         cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:318
                 call at org/jruby/runtime/callsite/CachingCallSite.java:155
     invokeOther0:new at -e:1
               <main> at -e:1
  invokeWithArguments at java/lang/invoke/MethodHandle.java:627
                 load at org/jruby/ir/Compiler.java:95
            runScript at org/jruby/Ruby.java:828
          runNormally at org/jruby/Ruby.java:747
          runNormally at org/jruby/Ruby.java:765
          runFromMain at org/jruby/Ruby.java:578
        doRunFromMain at org/jruby/Main.java:417
          internalRun at org/jruby/Main.java:305
                  run at org/jruby/Main.java:232
                 main at org/jruby/Main.java:204

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions