[ 
https://issues.apache.org/jira/browse/MAPREDUCE-5833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13967350#comment-13967350
 ] 

Zhijie Shen commented on MAPREDUCE-5833:
----------------------------------------

The first race condition happens at
{code}
    mrApp.waitForState(job, JobState.RUNNING);

    amDispatcher.await();
    // Wait till all map-attempts request for containers
    for (Task t : job.getTasks().values()) {
      if (t.getType() == TaskType.MAP) {
        mrApp.waitForInternalState((TaskAttemptImpl) t.getAttempts().values()
            .iterator().next(), TaskAttemptStateInternal.UNASSIGNED);
      }
    }
{code}
When the job is at SETUP *internally*, waitForState (external state) will be 
passed. However, a task may still not have an attempt before it reaches 
SCHEDULED, which is triggered by SetupCompletedTransition, and ultimately 
triggered by JOB_SETUP_COMPLETED. This event is emitted from a separate thread 
of CommitterEventHandler. While the job is at SETUP *internally*, this event 
hasn't been emitted. We should waitForInternalState(RUNNING) to make sure the 
event has been emitted.

> TestRMContainerAllocator fails ocassionally
> -------------------------------------------
>
>                 Key: MAPREDUCE-5833
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-5833
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>            Reporter: Zhijie Shen
>            Assignee: Zhijie Shen
>
> testReportedAppProgress and testReportedAppProgressWithOnlyMaps have race 
> conditions.
> {code}
> Stacktrace
> java.util.NoSuchElementException: null
>       at java.util.Collections$EmptyIterator.next(Collections.java:2998)
>       at 
> org.apache.hadoop.mapreduce.v2.app.TestRMContainerAllocator.testReportedAppProgress(TestRMContainerAllocator.java:535)
> {code}
> {code}
> Error Message
> Task state is not correct (timedout) expected:<RUNNING> but was:<SCHEDULED>
> Stacktrace
> junit.framework.AssertionFailedError: Task state is not correct (timedout) 
> expected:<RUNNING> but was:<SCHEDULED>
>       at junit.framework.Assert.fail(Assert.java:50)
>       at junit.framework.Assert.failNotEquals(Assert.java:287)
>       at junit.framework.Assert.assertEquals(Assert.java:67)
>       at org.apache.hadoop.mapreduce.v2.app.MRApp.waitForState(MRApp.java:393)
>       at 
> org.apache.hadoop.mapreduce.v2.app.TestRMContainerAllocator.testReportedAppProgressWithOnlyMaps(TestRMContainerAllocator.java:700)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to