From 2f66f0b83a52b2d80f82a21f91afa85565492a85 Mon Sep 17 00:00:00 2001 From: cxzl25 Date: Tue, 25 Apr 2023 06:22:49 +0800 Subject: [PATCH] HADOOP-18694. Client.Connection#updateAddress needs to ensure that address is resolved before updating (#5542). Contributed by dzcxzl. Reviewed-by: Steve Vaughan Reviewed-by: He Xiaoqiao Signed-off-by: Ayush Saxena ) () -> { + client.call(RpcKind.RPC_BUILTIN, new LongWritable(RANDOM.nextLong()), + remoteId, RPC.RPC_SERVICE_CLASS_DEFAULT, null); + return null; + }); + + assertFalse(address.isUnresolved()); + assertFalse(remoteId.getAddress().isUnresolved()); + assertEquals(System.identityHashCode(remoteId.getAddress()), + System.identityHashCode(address)); + + NetUtils.addStaticResolution("localhost", "host.invalid"); + LambdaTestUtils.intercept(IOException.class, (Callable) () -> { + client.call(RpcKind.RPC_BUILTIN, new LongWritable(RANDOM.nextLong()), + remoteId, RPC.RPC_SERVICE_CLASS_DEFAULT, null); + return null; + }); + + assertFalse(remoteId.getAddress().isUnresolved()); + assertEquals(System.identityHashCode(remoteId.getAddress()), + System.identityHashCode(address)); + } finally { + client.stop(); + server.stop(); + } + } + private void checkUserBinding(boolean asProxy) throws Exception { Socket s; // don't attempt bind with no service host.