[
https://issues.apache.org/jira/browse/FLINK-33917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17799352#comment-17799352
]
Maximilian Michels commented on FLINK-33917:
--------------------------------------------
The description doesn’t describe under which circumstances the host name can be
parsed as null. One example is {{new URI("123-test")}} which will return a null
host name because the string is parsed as a URI path. Flink itself returns a
stringified URL object. So using URL instead works fine.
> IllegalArgumentException: hostname can't be null
> ------------------------------------------------
>
> Key: FLINK-33917
> URL: https://issues.apache.org/jira/browse/FLINK-33917
> Project: Flink
> Issue Type: Bug
> Components: Kubernetes Operator
> Reporter: Tom
> Priority: Major
> Labels: pull-request-available
>
> In certain scenarios, if the hostname contains certain characters it will
> throw an exception when it tries to initialize the `InetSocketAddress`
>
> {code:java}
> java.lang.IllegalArgumentException: hostname can't be null at
> java.base/java.net.InetSocketAddress.checkHost(InetSocketAddress.java:149)
> at
> java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:216) {code}
>
> [https://github.com/apache/flink-kubernetes-operator/blob/main/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java|https://github.com/apache/flink-kubernetes-operator/blob/main/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/service/AbstractFlinkService.java#L236]
>
> {code:java}
> @Override
> public boolean isJobManagerPortReady(Configuration config) {
> final URI uri;
> try (var clusterClient = getClusterClient(config)) {
> uri = URI.create(clusterClient.getWebInterfaceURL());
> } catch (Exception ex) {
> throw new FlinkRuntimeException(ex);
> }
> SocketAddress socketAddress = new InetSocketAddress(uri.getHost(),
> uri.getPort());
> Socket socket = new Socket();
> try {
> socket.connect(socketAddress, 1000);
> socket.close();
> return true;
> } catch (IOException e) {
> return false;
> }
> }
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)