Detached `virtualLatestPath` when recovering the executor. Previously we miss to detach `/frameworks/FID/executors/EID/runs/latest` when we find the latest run of the executor was completed in the method `Framework::recoverExecutor`, that is a leak.
Review: https://reviews.apache.org/r/65167 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f25c9b3f Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f25c9b3f Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f25c9b3f Branch: refs/heads/1.5.x Commit: f25c9b3f77df9f4edc250e18be7392391d19d024 Parents: f2466a7 Author: Qian Zhang <[email protected]> Authored: Mon Jan 15 16:40:00 2018 +0800 Committer: Qian Zhang <[email protected]> Committed: Wed Jan 17 12:08:49 2018 +0800 ---------------------------------------------------------------------- src/slave/slave.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/f25c9b3f/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 4a37041..956f79d 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -8640,7 +8640,10 @@ void Framework::recoverExecutor( // GC the top level executor work directory. slave->garbageCollect(paths::getExecutorPath( slave->flags.work_dir, slave->info.id(), id(), state.id)) - .onAny(defer(slave, &Slave::detachFile, latestPath)); + .onAny(defer(slave->self(), [=](const Future<Nothing>& future) { + slave->detachFile(latestPath); + slave->detachFile(virtualLatestPath); + })); // GC the top level executor meta directory. slave->garbageCollect(paths::getExecutorPath(
