[
https://issues.apache.org/jira/browse/YARN-4306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15030122#comment-15030122
]
Sunil G commented on YARN-4306:
-------------------------------
Analysis:
>From {{SecurityUtil#getByName}},
{code}
// it's a simple host with no dots, ex. "host"
// try the search list, then fallback to exact host
InetAddress loopback = InetAddress.getByName(null);
if (host.equalsIgnoreCase(loopback.getHostName())) {
addr = InetAddress.getByAddress(host, loopback.getAddress());
} else {
addr = getByNameWithSearch(host);
if (addr == null) {
addr = getByExactName(host);
}
}
{code}
This code will hit while trying to resolve hostname to IP Address (For eg:
Hostname is "sunil-Inspiron-3543").
Also a my "/etc/hosts" will look like below:
{noformat}
127.0.0.1 localhost
127.0.1.1 sunil-Inspiron-3543
{noformat}
When I debugged this, I could see that {{InetAddress.getByName(null)}} returns
"localhost" and comparision fails as my hostname is "sunil-Inspiron-3543".
This will take the code to hit the method {{getByNameWithSearch}} and
subsequently {{getByExactName}} as getByNameWithSearch will also fail (no DNS
is configured).
{code}
InetAddress getByExactName(String host) {
InetAddress addr = null;
// InetAddress will use the search list unless the host is rooted
// with a trailing dot. The trailing dot will disable any use of the
// search path in a lower level resolver. See RFC 1535.
String fqHost = host;
if (!fqHost.endsWith(".")) fqHost += ".";
try {
addr = getInetAddressByName(fqHost);
...
{code}
Since {{if (!fqHost.endsWith(".")) fqHost += ".";}} is performed before
{{getInetAddressByName}}, this lookup also will fail. If this is not added,
then lookup is coming successful. This causes the test failure. Basically an
*UnKnownHostException* causing test failures.
Solution:
1, loopback address configuration can be changed to use hostname
2, use DNS in local machine
3, we can make changes in {{getByExactName}} where we check with given hostname
itself before doing with *hostname + "."*.
Kindly help to share your thoughts.
> Test failure: TestClientRMTokens
> --------------------------------
>
> Key: YARN-4306
> URL: https://issues.apache.org/jira/browse/YARN-4306
> Project: Hadoop YARN
> Issue Type: Bug
> Components: test
> Reporter: Sunil G
> Assignee: Sunil G
>
> Tests are getting failed in local also. As part of HADOOP-12321 jenkins run,
> I see same error.:
> {noformat}testShortCircuitRenewCancelDifferentHostSamePort(org.apache.hadoop.yarn.server.resourcemanager.TestClientRMTokens)
> Time elapsed: 0.638 sec <<< FAILURE!
> java.lang.AssertionError: expected:<getProxy> but was:<null>
> at org.junit.Assert.fail(Assert.java:88)
> at org.junit.Assert.failNotEquals(Assert.java:743)
> at org.junit.Assert.assertEquals(Assert.java:118)
> at org.junit.Assert.assertEquals(Assert.java:144)
> at
> org.apache.hadoop.yarn.server.resourcemanager.TestClientRMTokens.checkShortCircuitRenewCancel(TestClientRMTokens.java:363)
> at
> org.apache.hadoop.yarn.server.resourcemanager.TestClientRMTokens.testShortCircuitRenewCancelDifferentHostSamePort(TestClientRMTokens.java:316)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)