Skip to content

Commit a0df012

Browse files
authored
YARN-11834: Capacity Scheduler Application Stuck In ACCEPTED State due to Race Condition (#7806) Contributed by Syed Shameerur Rahman.
* YARN-11834: Capacity Scheduler Application Stuck In ACCEPTED State due to Race Condition Signed-off-by: Shilun Fan <[email protected]>
1 parent c357e43 commit a0df012

File tree

1 file changed

+9
-1
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity

1 file changed

+9
-1
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractLeafQueue.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,11 @@ public CSAssignment assignContainers(Resource clusterResource,
12121212
assignmentIterator.hasNext();) {
12131213
FiCaSchedulerApp application = assignmentIterator.next();
12141214

1215+
// Skip processing if the application is already removed from the applicationAttemptMap
1216+
if (!applicationAttemptMap.containsKey(application.getApplicationAttemptId())) {
1217+
continue;
1218+
}
1219+
12151220
ActivitiesLogger.APP.startAppAllocationRecording(activitiesManager,
12161221
node, SystemClock.getInstance().getTime(), application);
12171222

@@ -1264,7 +1269,10 @@ public CSAssignment assignContainers(Resource clusterResource,
12641269
userAssignable = canAssignToUser(clusterResource, application.getUser(),
12651270
userLimit, application, candidates.getPartition(),
12661271
currentResourceLimits);
1267-
if (!userAssignable && Resources.fitsIn(cul.reservation, appReserved)) {
1272+
if (!userAssignable
1273+
&& Resources.fitsIn(cul.reservation, appReserved)
1274+
// Consider updating cul only if the application attempt is active.
1275+
&& applicationAttemptMap.containsKey(application.getApplicationAttemptId())) {
12681276
cul.canAssign = false;
12691277
cul.reservation = appReserved;
12701278
}

0 commit comments

Comments
 (0)