MCPcopy Create free account
hub / github.com/apache/mesos / nestedCommandCheckFailure

Method nestedCommandCheckFailure

src/checks/checker_process.cpp:858–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856
857
858void CheckerProcess::nestedCommandCheckFailure(
859 shared_ptr<Promise<int>> promise,
860 http::Connection connection,
861 const ContainerID& checkContainerId,
862 shared_ptr<bool> checkTimedOut,
863 const string& failure,
864 runtime::Nested nested)
865{
866 if (*checkTimedOut) {
867 // The check timed out, closing the connection will make the agent
868 // kill the container.
869 connection.disconnect();
870
871 // If the check delay interval is zero, we'll try to perform another
872 // check right after we finish processing the current timeout.
873 //
874 // We'll try to remove the container created for the check at the
875 // beginning of the next check. In order to prevent a failure, the
876 // promise should only be completed once we're sure that the
877 // container has terminated.
878 waitNestedContainer(checkContainerId, nested)
879 .onAny([failure, promise](const Future<Option<int>>&) {
880 // We assume that once `WaitNestedContainer` returns,
881 // irrespective of whether the response contains a failure, the
882 // container will be in a terminal state, and that it will be
883 // possible to remove it.
884 //
885 // This means that we don't need to retry the `WaitNestedContainer`
886 // call.
887 promise->fail(failure);
888 });
889 } else {
890 // The agent was not able to complete the request, discarding the
891 // promise signals the checker that it should retry the check.
892 //
893 // This will allow us to recover from a blip. The executor will
894 // pause the checker when it detects that the agent is not
895 // available. Here we do not need to wait the check container since
896 // the agent may have been unavailable, and when the agent is back,
897 // it will destroy the check container as orphan container, and we
898 // will eventually remove it in `nestedCommandCheck()`.
899 LOG(WARNING) << "Connection to the agent to launch " << name
900 << " for task '" << taskId << "' failed: " << failure;
901
902 promise->discard();
903 }
904}
905
906
907Future<Option<int>> CheckerProcess::waitNestedContainer(

Callers

nothing calls this directly

Calls 3

disconnectMethod · 0.45
failMethod · 0.45
discardMethod · 0.45

Tested by

no test coverage detected