[
https://issues.apache.org/jira/browse/HADOOP-14637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080601#comment-16080601
]
Jason Lowe commented on HADOOP-14637:
-------------------------------------
I think the precondition check really did catch a bug here. From the
TestRMRestart code:
{code}
final int maxRetry = 10;
final RMApp rmAppForCheck = rmApp;
GenericTestUtils.waitFor(
new Supplier<Boolean>() {
@Override
public Boolean get() {
return new Boolean(rmAppForCheck.getAppAttempts().size() == 4);
}
},
100, maxRetry);
Assert.assertEquals(RMAppAttemptState.FAILED,
rmApp.getAppAttempts().get(latestAppAttemptId).getAppAttemptState());
{code}
>From the variable names and values, I'm guessing the intent here was to check
>every 100 milliseconds for 10 total checks (i.e.: a maximum cumulative wait
>time of one second). However this code is only going to check once, and if
>that check fails it will sleep for 100 milliseconds then throw an exception.
>That is clearly not intended by the caller, otherwise they would skip all this
>boilerplate and just code up the check directly in their unit test.
Besides the bug in TestRMRestart, it would be useful for
GenericTestUtils.waitFor to do one last check after the time expired before
throwing the timeout exception. At least that would do something semantically
useful if we remove this precondition check and allow the wait interval to be
less than the check interval.
> After HADOOP-14568, TestRMRestart.testRMRestartWaitForPreviousAMToFinish()
> fails with IllegalArgumentException
> --------------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-14637
> URL: https://issues.apache.org/jira/browse/HADOOP-14637
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 3.0.0-alpha4
> Reporter: Daniel Templeton
> Assignee: Daniel Templeton
> Labels: newbie
> Attachments: HADOOP-14637.001.patch, HADOOP-14637.002.patch
>
>
> {noformat}
> org.apache.hadoop.yarn.server.resourcemanager.TestRMRestart
> testRMRestartWaitForPreviousAMToFinish(org.apache.hadoop.yarn.server.resourcemanager.TestRMRestart)
> Time elapsed: 23.718 sec <<< ERROR!
> java.lang.IllegalArgumentException: Total wait time should be greater than
> check interval time
> at
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:88)
> at
> org.apache.hadoop.test.GenericTestUtils.waitFor(GenericTestUtils.java:341)
> at
> org.apache.hadoop.yarn.server.resourcemanager.TestRMRestart.testRMRestartWaitForPreviousAMToFinish(TestRMRestart.java:618)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]