7 Replies Latest reply on May 5, 2016 5:08 AM by Michal Karm

    Can't register when machine has 2 IPs

    Bill Burke Master

      I'm running in domain mode using the example provided by Stuart Douglas:

       

      GitHub - stuartwdouglas/modcluster-example: Example of how to use modcluster load balancer in domain mode

       

      I have 2 ip addresses on my laptop, ethernet (10.10.x.x) and wireless (192.168.x.x).  If I set jboss.bind.address to 192.168.x.x the backends can't register.  I get this error:

       

      [Server:backend1] 11:12:03,392 ERROR [org.jboss.modcluster] (UndertowEventHandlerAdapter - 1) MODCLUSTER000043: Failed to send INFO command to William-MYTH/10.10.49.48:8080: Connection refused: connect
      [Server:backend2] 11:12:05,998 ERROR [org.jboss.modcluster] (UndertowEventHandlerAdapter - 1) MODCLUSTER000043: Failed to send INFO command to William-MYTH/10.10.49.48:8080: Connection refused: connect

      The backends think they have to connect to 10.10.x.x.  I don't know how to fix this as I didn't see anywhere how to set the interface for this type of thing.  If I set the bind address to 10.10.49.48, everything works.

        • 1. Re: Can't register when machine has 2 IPs
          Michal Karm Apprentice

          Dear Bill, it is a known issue caused by the Undertow mod_cluster proxy lying to the workers about its true location in the network: see [UNDERTOW-704] Undertow mod_cluster: Multiinterface box: Manager-Address always contains hostname - JBoss Issue Tracker

          You could work-around that by editing your /etc/hosts and creating different hostnames for your IP addresses.

          • 2. Re: Can't register when machine has 2 IPs
            Bill Burke Master

            I would submit a PR, but I can't seem to figure out where the registration message gets sent.  Point me to the class if you can and I'll do the rest

            • 3. Re: Can't register when machine has 2 IPs
              Michal Karm Apprentice

              The message in question is generated here; the root cause is IMHO getHostString usage of InetSocketAddress.

              The hostname that I think would better be off as an IP address if user explicitly wanted to use IP address comes from Wildfly configuration in ModClusterService. This is the SocketBinding class.

               

              In my opinion, it is not desirable to change the way InetAddress is handled. I would leave it as it is and I would suggest adding an option to overwrite the Manager-Address with whatever user wants in the Undertow subsystem mod_cluster filter configuration.  WDYT, swd847 ?

              • 4. Re: Can't register when machine has 2 IPs
                Bill Burke Master

                I think it should use whatever interface is provided by the undertow subsystem.  This stuff is already hard to figure out how to install.  Reducing the number of moving parts is needed.

                • 5. Re: Can't register when machine has 2 IPs
                  Michal Karm Apprentice

                  That is not a correct approach. In production environments, it is common to have the balancer bound to an Internet facing NIC for processing client's requests and to an internal network NIC for processing mod_cluster workers' MCMP service messages and communicating with workers.

                   

                  As I think about it, In the Undertow mod_cluster Proxy implementation, it should be possible to use two socket-bindings (with different interface attributes): one for the client - balacner communication and the other for worker - balancer communication. I have to take a look whether it could be achieved with the current code by configuring more Undertow hosts with different socket-bindings.

                   

                  The possibility to alter X-Manager-Address and X-Manager-Host via a direct configuration still seems plausible to me though.

                  • 6. Re: Can't register when machine has 2 IPs
                    Stuart Douglas Master

                    Mod_cluster already supports specifying the binding, the underlying issue here is that both NIC's resolve to the same hostname, which means that we advertise the host name it is not clear which one the client should connect to. This sort of issue should not really happen on production servers, as both NIC's should have separate host names (hopefully).

                     

                    I talked to JFC and apparently sending the host name is by design, I'm not really sure how big a deal this is as it only affects multi homed machines where the NIC's share a hostname.

                    • 7. Re: Can't register when machine has 2 IPs
                      Michal Karm Apprentice

                      In my mind, this is probably mostly a developer workstation thing. I hit the issue for the exactly same reason: having multiple NICs and a single hostname.

                      It is noteworthy though that Apache HTTP Server mod_cluster does let you use IP addresses and does not perform any shenanigans with resolving them to hostnames if you don't wish it to.


                      Most importantly, Apache HTTP Server mod_cluster implementation lets you set the Manager-Url explicitly if you wish to, see X-Manager-Url:

                      If I am not mistaken, Undertow does not let you set any explicit address.

                       

                      IMHO, It is important to let users do that not only because of IP/hostname problem but also to allow them to solve situation where balancer appears to workers be reachable from a different network than it itself "thinks" it is in.