Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-7096

When rmiServerHost is 127.0.0.1, RMIServerImpl_Stub still uses hostname's IP

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.2.11, 4.3.1
    • 4.2.12, 4.3.2
    • None
    • None

    Description

      It's a follow-up of the investigation from KARAF-6955. Copying the description:

      I had problem after this change - jconsole stopped working and sample Java application ended with Connection refused exception.

      I did enjoyable analysis and I found that:

      • ports are opened on proper interfaces (::ffff:127.0.0.1 in my case, which is an IPv6 address from ::ffff:0:0/96 CIDR that represents Transition from IPv4 address block)
      • I could connect to RMI Registry at port 1099 and even obtain karaf-root object from there, which:
        • is of javax.management.remote.rmi.RMIServer interface
        • is of javax.management.remote.rmi.RMIServerImpl_Stub implementation

      The problem is that this stub contains:

      ref: java.rmi.server.RemoteRef  = {sun.rmi.server.UnicastRef2@1918} 
      ...
       ref: sun.rmi.transport.LiveRef  = {sun.rmi.transport.LiveRef@1925} "[endpoint:[192.168.0.38:44444](remote),objID:[2f23195f:178a6a29327:-7ffa, 4962682433218761153]]"
        ep: sun.rmi.transport.Endpoint  = {sun.rmi.transport.tcp.TCPEndpoint@1927} "[192.168.0.38:44444]"
         host: java.lang.String  = "192.168.0.38"
         port: int  = 44444 (0xAD9C)
      

      The problem is that when RMIServerImpl_Stub is created at server side by karaf.management.server bundle, the bind address of this remote object is NOT taken from rmiServerHost property of org.apache.karaf.management PID. It's taken from (top to bottom):

      • sun.rmi.transport.tcp.TCPEndpoint#getLocalEndpoint()
      • java.net.InetAddress#getLocalHost()
      • java.net.InetAddressImpl#getLocalHostName()
      • java.net.InetAddress#getAddressesFromNameService()
      • java.net.Inet6AddressImpl#lookupAllHostAddr()
      • getaddress() libc method
      • /etc/hosts

      The way to solve this is to set java.rmi.server.hostname system property to 127.0.0.1, so the Stub contains proper address.

      Attachments

        Issue Links

          Activity

            People

              ggrzybek Grzegorz Grzybek
              ggrzybek Grzegorz Grzybek
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: