You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/06/25 03:57:43 UTC
[5/7] mesos git commit: Avoided master crash on agent re-registration.
Avoided master crash on agent re-registration.
When validating the agent's ReregisterSlaveMessage, the master's
validation code neglected to account for the fact that the task
resources might not be in post-refinement format (e.g., if the agent
does not support reservation refinement). This lead to a `CHECK` failure
during validation.
Fix this by relaxing the validation of ReregisterSlaveMessage so that we
do not depend on the task resources being in post-refinement
format. This means validation of ReregisterSlaveMessage will be less
effective, but since it is best-effort anyway, this seems tolerable.
Review: https://reviews.apache.org/r/60407
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/46387fbe
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/46387fbe
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/46387fbe
Branch: refs/heads/master
Commit: 46387fbea2cd4dde3bbd4f306a527e22c5348ea8
Parents: 8bfb411
Author: Neil Conway <ne...@gmail.com>
Authored: Fri Jun 23 17:25:16 2017 -0700
Committer: Neil Conway <ne...@gmail.com>
Committed: Sat Jun 24 20:57:25 2017 -0700
----------------------------------------------------------------------
src/master/validation.cpp | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/46387fbe/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index 33e9ff7..4885339 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -318,9 +318,13 @@ Option<Error> reregisterSlave(
return error.get();
}
- // We don't use internal::validateResources() here because
- // that includes the validateAllocatedToSingleRole() check,
- // which is not valid for agent re-registration.
+ // We don't use `internal::validateResources` here because that
+ // includes the `validateAllocatedToSingleRole` check, which is
+ // not valid for agent re-registration.
+ //
+ // TODO(neilc): Consider refactoring `internal::validateResources`
+ // to allow some but not all checks to be applied, or else inject
+ // allocation info into executor resources here.
error = Resources::validate(executor.resources());
if (error.isSome()) {
return error.get();
@@ -367,7 +371,13 @@ Option<Error> reregisterSlave(
}
}
- error = resource::validate(task.resources());
+ // We don't use `resource::validate` here because the task's
+ // resources might not be in "post-reservation refinement" format.
+ //
+ // TODO(neilc): Consider refactoring `resource::validate` to allow
+ // some but not all checks to be applied, or else convert the
+ // task's resources into post-refinement format here.
+ error = Resources::validate(task.resources());
if (error.isSome()) {
return Error("Task uses invalid resources: " + error->message);
}