joey commented on a change in pull request #6862: [FLINK-10213] Task managers 
cache a negative DNS lookup of the blob server indefinitely
URL: https://github.com/apache/flink/pull/6862#discussion_r240666825
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobClient.java
 ##########
 @@ -87,12 +87,13 @@ public BlobClient(InetSocketAddress serverAddress, 
Configuration clientConfig) t
                                LOG.info("Using ssl connection to the blob 
server");
 
                                socket = 
SSLUtils.createSSLClientSocketFactory(clientConfig).createSocket(
-                                       serverAddress.getAddress(),
+                                       serverAddress.getHostName(),
                                        serverAddress.getPort());
                        }
                        else {
-                               socket = new Socket();
-                               socket.connect(serverAddress);
+                               // Establish the socket using the hostname and 
port. This avoids a potential issue where the
+                               // InetSocketAddress can cache a failure in 
hostname resolution forever.
+                               socket = new 
Socket(serverAddress.getHostName(), serverAddress.getPort());
 
 Review comment:
   We can do that, but I'm not sure it's the best idea. Since the resolution in 
`InetSocketAddress` only happens when the object is instantiated, you could 
cache an old name resolution. The most likely reason for this to happen would 
be a deployment environment such as Kubernetes. If the JobManger pod is 
restarted, then a new pod will take over and will get assigned a new IP 
address. Kubernetes will automatically update the DNS entry using KubeDNS for 
the service name. I think that means you could have a situation where the 
`InetSocketAdress` says it's resolved, but it cached an old resolution. The 
safest thing is to force the DNS resolution when we make the connection. Both 
Java and the kernel will already cache the DNS entry based on the TTL in the 
DSN record, so I don't think we gain much by adding an additional caching layer 
in the `InetSocketAddress` itself.
   
   Let me know if you agree or if we should still consider the change.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to