GEODE-980: The member's local hostname is just an IP address - Trouble on Mac OS is that the hostname is not tied to a particular address like other *nix systems. A typical *nix system might have the hostname defined in /etc/hosts or resolvable via DNS. The hostname/IP mapping remains fixed and consistent. Under Mac OS (and at least under Java) the InetAddress.getLocalHost call is not deterministic and may associate the local hostname with any of the hosts' currently assigned IP addresses. There is no mapping done through /etc/hosts. This also means that given a localhost InetAddress, a reverse DNS lookup of the address will fail. - By using only the IP address for the local hostname, the member ID remains consistent.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/bde4dd7c Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/bde4dd7c Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/bde4dd7c Branch: refs/heads/develop Commit: bde4dd7c9c3b135a5c89501c8c8f1e75a6082d09 Parents: ae7d4da Author: Jens Deppe <[email protected]> Authored: Thu Mar 17 07:31:40 2016 -0700 Committer: Jens Deppe <[email protected]> Committed: Mon Mar 21 14:32:42 2016 -0700 ---------------------------------------------------------------------- .../src/main/java/com/gemstone/gemfire/internal/SocketCreator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bde4dd7c/geode-core/src/main/java/com/gemstone/gemfire/internal/SocketCreator.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/SocketCreator.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/SocketCreator.java index 458f41a..2130a26 100755 --- a/geode-core/src/main/java/com/gemstone/gemfire/internal/SocketCreator.java +++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/SocketCreator.java @@ -176,7 +176,7 @@ public class SocketCreator { static { InetAddress lh = null; try { - lh = InetAddress.getLocalHost(); + lh = InetAddress.getByAddress(InetAddress.getLocalHost().getAddress()); if (lh.isLoopbackAddress()) { InetAddress ipv4Fallback = null; InetAddress ipv6Fallback = null;
