[ https://issues.apache.org/jira/browse/HADOOP-17837?focusedWorklogId=635044&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-635044 ]
ASF GitHub Bot logged work on HADOOP-17837: ------------------------------------------- Author: ASF GitHub Bot Created on: 06/Aug/21 10:42 Start Date: 06/Aug/21 10:42 Worklog Time Spent: 10m Work Description: steveloughran commented on a change in pull request #3272: URL: https://github.com/apache/hadoop/pull/3272#discussion_r684137107 ########## File path: hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java ########## @@ -111,6 +111,7 @@ public void testInvalidAddress() throws Throwable { fail("Should not have connected"); } catch (UnknownHostException uhe) { LOG.info("Got exception: ", uhe); + assertEquals("invalid-test-host:0", uhe.getMessage()); Review comment: Use `GenericTestUtils.assertExceptionContains()`; this rethrows the exception if there's no match, and allows for extra text in the messge ########## File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java ########## @@ -589,7 +589,7 @@ public static void connect(Socket socket, } catch (SocketTimeoutException ste) { throw new ConnectTimeoutException(ste.getMessage()); } catch (UnresolvedAddressException uae) { - throw new UnknownHostException(uae.getMessage()); + throw new UnknownHostException(endpoint.toString()); Review comment: we still need that message from the original string so build it from `uhe.getMessage() + " " + endpoint` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 635044) Time Spent: 40m (was: 0.5h) > Make it easier to debug UnknownHostExceptions from NetUtils.connect > ------------------------------------------------------------------- > > Key: HADOOP-17837 > URL: https://issues.apache.org/jira/browse/HADOOP-17837 > Project: Hadoop Common > Issue Type: Improvement > Reporter: Bryan Beaudreault > Assignee: Bryan Beaudreault > Priority: Minor > Labels: pull-request-available > Fix For: 3.4.0, 3.3.2 > > Time Spent: 40m > Remaining Estimate: 0h > > Most UnknownHostExceptions thrown throughout hadoop include a useful message, > either the hostname that was not found or some other descriptor of the > problem. The UnknownHostException thrown from NetUtils.connect only includes > the [message of the underlying > UnresolvedAddressException|https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java#L592]. > If you take a look at the source for UnresolvedAddressException, [it only > has a no-args > constructor|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/channels/UnresolvedAddressException.html] > (java11, but same is true in other versions). So it never has a message, > meaning the UnknownHostException message is empty. > We should include the endpoint.toString() in the UnknownHostException thrown > by NetUtils.connect -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org