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

Karthik Kambatla commented on YARN-2945:
----------------------------------------

Other committers: please hold off on committing this until I get a chance to 
take a close look. 

During the course of YARN-2910, we ended up with a deadlock when we held the 
equivalent of write lock over the entire block. While it is true in theory,  
the queue might become unsorted but that should be okay in practice. Actually, 
we have been considering sorting only periodically for better performance. 

> FSLeafQueue should hold lock before and after sorting runnableApps in 
> assignContainer
> -------------------------------------------------------------------------------------
>
>                 Key: YARN-2945
>                 URL: https://issues.apache.org/jira/browse/YARN-2945
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Tsuyoshi OZAWA
>            Assignee: Tsuyoshi OZAWA
>         Attachments: YARN-2945.001.patch
>
>
> After YARN-2910, assignContainer hold WriteLock while sorting and ReadLock 
> while referencing runnableApps. This can cause interrupted assignment of 
> containers regardless of the policy.
> {code}
>     writeLock.lock();
>     try {
>       Collections.sort(runnableApps, comparator);
>     } finally {
>       writeLock.unlock();
>     }
>     readLock.lock();
>     try {
>       for (FSAppAttempt sched : runnableApps) {
>         if (SchedulerAppUtils.isBlacklisted(sched, node, LOG)) {
>           continue;
>         }
>         assigned = sched.assignContainer(node);
>         if (!assigned.equals(Resources.none())) {
>           break;
>         }
>        }
>     } finally {
>       readLock.unlock();
>     }
> {code}



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

Reply via email to