[
https://issues.apache.org/jira/browse/FLINK-2821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15751596#comment-15751596
]
ASF GitHub Bot commented on FLINK-2821:
---------------------------------------
Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/2917#discussion_r92626161
--- Diff: flink-core/src/main/java/org/apache/flink/util/NetUtils.java ---
@@ -111,7 +115,51 @@ public static int getAvailablePort() {
//
------------------------------------------------------------------------
// Encoding of IP addresses for URLs
//
------------------------------------------------------------------------
-
+
+ /**
+ * Returns an address in a normalized format for Akka.
+ * When an IPv6 address is specified, it normalizes the IPv6 address to
avoid
+ * complications with the exact URL match policy of Akka.
+ * @param host The hostname, IPv4 or IPv6 address
+ * @return host which will be normalized if it is an IPv6 address
+ */
+ public static String unresolvedHostToNormalizedString(String host) {
+ // Return loopback interface address if host is null
+ // This represents the behavior of {@code InetAddress.getByName
} and RFC 3330
+ if (host == null) {
+ host =
InetAddress.getLoopbackAddress().getHostAddress();
+ } else {
+ host = host.trim().toLowerCase();
+ }
+
+ // normalize and valid address
+ if (IPAddressUtil.isIPv6LiteralAddress(host)) {
+ byte[] ipV6Address =
IPAddressUtil.textToNumericFormatV6(host);
+ host = getIPv6UrlRepresentation(ipV6Address);
+ } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) {
+ // We don't allow these in hostnames
+ Preconditions.checkArgument(!host.startsWith("."));
+ Preconditions.checkArgument(!host.endsWith("."));
+ Preconditions.checkArgument(!host.contains(":"));
--- End diff --
Maybe we could add a clarifying error message here for the user.
> Change Akka configuration to allow accessing actors from different URLs
> -----------------------------------------------------------------------
>
> Key: FLINK-2821
> URL: https://issues.apache.org/jira/browse/FLINK-2821
> Project: Flink
> Issue Type: Bug
> Components: Distributed Coordination
> Reporter: Robert Metzger
> Assignee: Maximilian Michels
>
> Akka expects the actor's URL to be exactly matching.
> As pointed out here, cases where users were complaining about this:
> http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Error-trying-to-access-JM-through-proxy-td3018.html
> - Proxy routing (as described here, send to the proxy URL, receiver
> recognizes only original URL)
> - Using hostname / IP interchangeably does not work (we solved this by
> always putting IP addresses into URLs, never hostnames)
> - Binding to multiple interfaces (any local 0.0.0.0) does not work. Still
> no solution to that (but seems not too much of a restriction)
> I am aware that this is not possible due to Akka, so it is actually not a
> Flink bug. But I think we should track the resolution of the issue here
> anyways because its affecting our user's satisfaction.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)