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

ASF GitHub Bot commented on YARN-11808:
---------------------------------------

Hexiaoqiao commented on code in PR #7583:
URL: https://github.com/apache/hadoop/pull/7583#discussion_r2031213556


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/scheduler/OpportunisticContainerContext.java:
##########
@@ -132,10 +133,25 @@ public void addToOutstandingReqs(List<ResourceRequest> 
resourceAsks) {
       SchedulerRequestKey schedulerKey = SchedulerRequestKey.create(request);
 
       Map<Resource, EnrichedResourceRequest> reqMap =
-          outstandingOpReqs.get(schedulerKey);
+          getOutstandingOpReqs().get(schedulerKey);
+
+      if (request.getNumContainers() == 0) {

Review Comment:
   it makes sense to me.



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/scheduler/TestOpportunisticContainerContext.java:
##########
@@ -0,0 +1,199 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.yarn.server.scheduler;
+
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.api.records.ResourceRequest;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.ArrayList;
+
+
+public class TestOpportunisticContainerContext {

Review Comment:
   Please follow the codestyle define,
   1. avoid to add some extra blank line.
   2. keep the same indent like other java files.
   3. it is better to use the following format for method code annotation.
   ```
   /**
    * some annotation.
    */
   ```
   Thanks.





> RM memory leak due to Opportunistic container request cancellation at App 
> level
> -------------------------------------------------------------------------------
>
>                 Key: YARN-11808
>                 URL: https://issues.apache.org/jira/browse/YARN-11808
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: RM, yarn
>            Reporter: Ashish Ranjan
>            Priority: Major
>              Labels: pull-request-available
>
> 2025-02-20T09:07:40,735 INFO  [2991] OpportunisticContainerContext: # of 
> outstandingOpReqs in ANY (at priority = 68, allocationReqId = 50657, with 
> capability = <memory:3072, vCores:2, network: 640Mi> ) : , with location = * 
> ) : , numContainers = 0
> 2025-02-20T09:07:40,735 INFO  [2991] OpportunisticContainerContext: # of 
> outstandingOpReqs in ANY (at priority = 68, allocationReqId = 50658, with 
> capability = <memory:3072, vCores:2, network: 640Mi> ) : , with location = * 
> ) : , numContainers = 0
> 2025-02-20T09:07:40,735 INFO  [2991] OpportunisticContainerContext: # of 
> outstandingOpReqs in ANY (at priority = 68, allocationReqId = 50659, with 
> capability = <memory:3072, vCores:2, network: 640Mi> ) : , with location = * 
> ) : , numContainers = 0
>  
>  
> numContainers = 0 denote we don't ant allocation of this type. But the map 
> object is persisted per application attempt and causing heap issue wastage in 
> RM.
>  
> In function addToOutstandingReqs * Incase the container request from AM is 
> zero we should make sure to clean up the map.
> Multiple issue due to this:
>  * Too much unnecessary logging.
>  * Memory leak in RM side.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to