You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Diego Rivera (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/01/26 06:23:40 UTC

[jira] [Issue Comment Edited] (JCS-89) UDP Discovery fails to report correct IP address to peers for back-connect when InetAddress.getLocalHost() fails to return an externally-visible address (i.e. returns a local address)

    [ https://issues.apache.org/jira/browse/JCS-89?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13193556#comment-13193556 ] 

Diego Rivera edited comment on JCS-89 at 1/26/12 5:22 AM:
----------------------------------------------------------

To clarify, the issue is that InetAddress.getLocalHost() may not always return an externally-visible address.  In particular, it may return a loopback address.  This means that under those circumstances, all caches in a UDP-discovery cluster will invariably discover only themselves, and thus the lateral cluster will be useless.

This patch addresses that by superseding the IP address from the UDPDiscoveryMessage.host property with the IP Address (NOT hostname, for speed, efficiency and certainty) from the actual UDP multicast packet that has just been received, and is being responded to.

This ensures there will be no confusion when performing the back-connect.
                
      was (Author: diego.rivera.cr@gmail.com):
    To clarify, the issue is that InetAddress.getLocalHost() may not always return an externally-visible address.  In particular, it may return a loopback address.  This means that under those circumstances, all caches in a UDP-discovery cluster will invariably discover only themselves, and thus the lateral cluster will be useless.

This patch addresses that by superseding the IP address from the UDPDiscoveryMessage.host property with the IP Address (NOT hostname, for speed, efficiency and certainty) from the actual UDP multicast packet that is being responded to.

This ensures there will be no confusion when performing the back-connect.
                  
> UDP Discovery fails to report correct IP address to peers for back-connect when InetAddress.getLocalHost() fails to return an externally-visible address (i.e. returns a local address)
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCS-89
>                 URL: https://issues.apache.org/jira/browse/JCS-89
>             Project: Commons JCS
>          Issue Type: Bug
>            Reporter: Diego Rivera
>         Attachments: jcs-89-fix.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> On certain environments where reverse-lookup of the machine's IP address isn't available, or other IP configurations restrict the ability of the JVM to determine its own "canonical" local address, it's impossible to determine ahead of time what address should be sent into the UDP multicast in order for lateral peers to establish the back-connection.
> The fix for this is simple: when the packet is received with the discovery message, determine the source host address of the packet that was received and set that to the discovery message's host property (setHost(packet.getAddress().getHostAddress()).  This way, it's 100% for certain we'll be back-connecting to the correct instance.
> A patch will be uploaded shortly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira