Searialized invocation of `await` in the status method. Review: https://reviews.apache.org/r/43673/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b45b9df7 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b45b9df7 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b45b9df7 Branch: refs/heads/master Commit: b45b9df715aa191722f22e57a15de3e6fbf22a4b Parents: 95a8fc3 Author: Avinash sridharan <[email protected]> Authored: Wed Feb 17 15:04:59 2016 -0800 Committer: Jie Yu <[email protected]> Committed: Wed Feb 17 15:06:19 2016 -0800 ---------------------------------------------------------------------- src/slave/containerizer/mesos/containerizer.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b45b9df7/src/slave/containerizer/mesos/containerizer.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index 3de214d..129406a 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -1345,9 +1345,18 @@ Future<ContainerStatus> MesosContainerizerProcess::status( futures.push_back(isolator->status(containerId)); } - // Using `await()` here so we can return partial status. - return await(futures).then( - lambda::bind(_status, containerId, lambda::_1)); + // We are using `await` here since we are interested in partial + // results from calls to `isolator->status`. We also need to + // serialize the invocation to `await` in order to maintain the + // order of requests for `ContainerStatus` by the agent. See + // MESOS-4671 for more details. + VLOG(2) << "Serializing status request for container: " << containerId; + + return containers_[containerId]->sequence.add<ContainerStatus>( + [=]() -> Future<ContainerStatus> { + return await(futures) + .then(lambda::bind(_status, containerId, lambda::_1)); + }); }
