This is an automated email from the ASF dual-hosted git repository.

josephwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 44c439baae0c273025f183ecf26e4b1bc4be8262
Author: Joseph Wu <[email protected]>
AuthorDate: Tue Feb 19 14:44:47 2019 -0800

    Removed operations when removing resource providers.
    
    When a resource provider explicitly disconnects from the agent, the
    agent will send a `UpdateSlaveMessage` to the master, telling the
    master to remove the resource provider.  If there are any operations
    associated with the resource provider, they must be removed too,
    because there is no way to make forward progress on resource provider
    operations without a resource provider.
    
    This removes a potential memory leak in the master's Framework structs.
    
    Review: https://reviews.apache.org/r/70014
---
 src/master/master.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/master/master.cpp b/src/master/master.cpp
index f71c6fd..665c1c7 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -8391,6 +8391,15 @@ void Master::updateSlave(UpdateSlaveMessage&& message)
       // total, but never in the used resources.
       CHECK(slave->resourceProviders.contains(resourceProviderId));
 
+      // Clean up any associated operations belonging to the removed
+      // resource provider.
+      foreachvalue (
+          Operation* operation,
+          utils::copy(slave->resourceProviders.at(resourceProviderId)
+            .operations)) {
+        removeOperation(operation);
+      }
+
       slave->totalResources -=
         slave->resourceProviders.at(resourceProviderId).totalResources;
 

Reply via email to