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

Peng Zhang commented on MAPREDUCE-5279:
---------------------------------------

Tanks [~vvasudev] for taking this. 
And after initial patch, we found one bug and fixed it in our branch. Code 
context is below:

{code}
   private List<Container> getResources() throws Exception {
-    int headRoom = getAvailableResources() != null
-        ? getAvailableResources().getMemory() : 0;//first time it would be null
+    Resource headRoom =
+        getAvailableResources() == null ? Resources.none()
+            : getAvailableResources(); // will be null the first time
     AllocateResponse response;
{code}

{code}
-    int newHeadRoom = getAvailableResources() != null ? 
getAvailableResources().getMemory() : 0;
+    Resource newHeadRoom =
+        getAvailableResources() == null ? Resources.none()
+            : getAvailableResources();
     List<Container> newContainers = response.getAllocatedContainers();
     // Setting NMTokens
{code}

{code}
-    if (newContainers.size() + finishedContainers.size() > 0 || headRoom != 
newHeadRoom) {
+    if (newContainers.size() + finishedContainers.size() > 0
+        || !headRoom.equals(newHeadRoom)) {
       //something changed
       recalculateReduceSchedule = true;
{code}

headRoom and  newHeadRoom reference to the same object, so equals check always 
return true except first time.
I fixed this by adding Resources.clone(getAvailableResources()) before calling 
makeRemoteRequest ();


> Jobs can deadlock if headroom is limited by cpu instead of memory
> -----------------------------------------------------------------
>
>                 Key: MAPREDUCE-5279
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-5279
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: mrv2, scheduler
>    Affects Versions: 2.0.3-alpha
>            Reporter: Peng Zhang
>            Assignee: Peng Zhang
>            Priority: Critical
>         Attachments: MAPREDUCE-5279-v2.patch, MAPREDUCE-5279.patch, 
> apache-mapreduce-5279.3.patch, apache-mapreduce-5279.4.patch
>
>
> YARN-2 imported cpu dimension scheduling, but MR RMContainerAllocator doesn't 
> take into account virtual cores while scheduling reduce tasks.
> This may cause more reduce tasks to be scheduled because memory is enough. 
> And on a small cluster, this will end with deadlock, all running containers 
> are reduce tasks but map phase is not finished. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to