[ https://issues.apache.org/jira/browse/YARN-11843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18012009#comment-18012009 ]
ASF GitHub Bot commented on YARN-11843: --------------------------------------- TaoYang526 commented on PR #7855: URL: https://github.com/apache/hadoop/pull/7855#issuecomment-3153138028 > @TaoYang526 - It is good catch indeed. Just curious to know - May i know the use case behind using auto-correction feature ? @shameersss1 Currently, we don't have a specific use case for the auto-correction feature. We have always been aware that YARN has an over-allocation issue, but considered it a minor concern, so no action was taken. When I discovered YARN-11702, I wanted to take a look and found that it could resolve most over-allocation issues, except for some in-scheduling cases. It's sufficient to reduce unnecessary consumption in the scheduling cycle and we may enable this feature in the future. > Fix potential deadlock when auto-correction of container allocation is enabled > ------------------------------------------------------------------------------ > > Key: YARN-11843 > URL: https://issues.apache.org/jira/browse/YARN-11843 > Project: Hadoop YARN > Issue Type: Bug > Components: scheduler > Affects Versions: 3.5.0 > Reporter: Tao Yang > Assignee: Tao Yang > Priority: Major > Labels: pull-request-available > > The feature introduced in YARN-11702 has a potential deadlock issue. When > enabled, it can cause deadlock when holding application-level write locks > while trying to acquire queue-level write locks. > > Root Cause: > - autoCorrectContainerAllocation is called while holding application-level > write locks > - It directly calls completedContainer() which requires queue-level write > locks > {code:java} > CapacityScheduler#allocate > --> ... > application.getWriteLock().lock(); //1. requires app writeLock!!! > try{ > ... > AbstractYarnScheduler#autoCorrectContainerAllocation > --> AbstractYarnScheduler#completedContainer > --> AbstractYarnScheduler#completedContainerInternal > --> AbstractLeafQueue#completedContainer > writeLock.lock() //2. requires queue writeLock!!! > try{ > ... > FiCaSchedulerApp#containerCompleted > //3. requires app writeLock!!! > }finally{ > writeLock.unlock(); > } > }finally{ > application.getWriteLock().unlock(); > }{code} > - This violates lock hierarchy and creates deadlock scenarios, since > AbstractYarnScheduler#completedContainer could be called from another thread > during normal container completion operations. > > Solution: > Replace direct completedContainer() calls with asyncContainerRelease() in > autoCorrectContainerAllocation method. > Before: > {code:java} > completedContainer(rmContainer, ...); // Direct call causes deadlock {code} > After: > {code:java} > asyncContainerRelease(rmContainer); // Async call avoids deadlock {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org