You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/03/28 18:19:08 UTC
[2/7] mesos git commit: Subprocess: [2/7] Removed the use of setup
functions.
Subprocess: [2/7] Removed the use of setup functions.
This review follows the previous one and removes most
(see following reviews) usages setup functions throughout
the code.
Review: https://reviews.apache.org/r/45231/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/5043f0d6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5043f0d6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5043f0d6
Branch: refs/heads/master
Commit: 5043f0d63425c29d4013c71d04a57ade25fe6996
Parents: f8364bb
Author: Joerg Schad <jo...@mesosphere.io>
Authored: Mon Mar 28 17:00:22 2016 +0200
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Mon Mar 28 18:16:47 2016 +0200
----------------------------------------------------------------------
src/docker/docker.cpp | 3 ++
src/health-check/main.cpp | 2 +
src/slave/container_loggers/lib_logrotate.cpp | 4 +-
src/slave/containerizer/docker.cpp | 27 ++-----------
.../containerizer/external_containerizer.cpp | 41 +++-----------------
src/slave/containerizer/fetcher.cpp | 1 +
src/slave/containerizer/mesos/containerizer.cpp | 1 -
.../mesos/isolators/posix/disk.cpp | 20 +---------
src/slave/containerizer/mesos/launcher.cpp | 26 +------------
src/slave/containerizer/mesos/launcher.hpp | 8 +---
.../containerizer/mesos/linux_launcher.cpp | 25 +-----------
.../containerizer/mesos/linux_launcher.hpp | 1 -
src/tests/containerizer/isolator_tests.cpp | 35 +++--------------
src/tests/containerizer/launch_tests.cpp | 2 +-
src/tests/containerizer/launcher.cpp | 6 +--
src/tests/containerizer/launcher.hpp | 3 +-
src/tests/containerizer/ns_tests.cpp | 2 +-
src/tests/slave_tests.cpp | 1 +
18 files changed, 36 insertions(+), 172 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index 4d35513..386f2f4 100755
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -664,6 +664,7 @@ Future<Nothing> Docker::run(
Subprocess::PATH("/dev/null"),
stdout,
stderr,
+ NO_SETSID,
None(),
environment);
@@ -1091,6 +1092,7 @@ Future<Docker::Image> Docker::pull(
Subprocess::PATH("/dev/null"),
Subprocess::PIPE(),
Subprocess::PIPE(),
+ NO_SETSID,
None());
if (s.isError()) {
@@ -1167,6 +1169,7 @@ Future<Docker::Image> Docker::__pull(
Subprocess::PATH("/dev/null"),
Subprocess::PIPE(),
Subprocess::PIPE(),
+ NO_SETSID,
None(),
environment);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/health-check/main.cpp
----------------------------------------------------------------------
diff --git a/src/health-check/main.cpp b/src/health-check/main.cpp
index 36955dd..98ea5d3 100644
--- a/src/health-check/main.cpp
+++ b/src/health-check/main.cpp
@@ -179,6 +179,7 @@ private:
Subprocess::PATH("/dev/null"),
Subprocess::FD(STDERR_FILENO),
Subprocess::FD(STDERR_FILENO),
+ process::NO_SETSID,
environment);
} else {
// Use the exec variant.
@@ -201,6 +202,7 @@ private:
Subprocess::PATH("/dev/null"),
Subprocess::FD(STDERR_FILENO),
Subprocess::FD(STDERR_FILENO),
+ process::NO_SETSID,
None(),
environment);
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/container_loggers/lib_logrotate.cpp
----------------------------------------------------------------------
diff --git a/src/slave/container_loggers/lib_logrotate.cpp b/src/slave/container_loggers/lib_logrotate.cpp
index cf5f238..1f22880 100644
--- a/src/slave/container_loggers/lib_logrotate.cpp
+++ b/src/slave/container_loggers/lib_logrotate.cpp
@@ -140,10 +140,10 @@ public:
Subprocess::FD(outfds.read, Subprocess::IO::OWNED),
Subprocess::PATH("/dev/null"),
Subprocess::FD(STDERR_FILENO),
+ NO_SETSID,
outFlags,
environment,
None(),
- None(),
parentHooks);
if (outProcess.isError()) {
@@ -187,10 +187,10 @@ public:
Subprocess::FD(errfds.read, Subprocess::IO::OWNED),
Subprocess::PATH("/dev/null"),
Subprocess::FD(STDERR_FILENO),
+ NO_SETSID,
errFlags,
environment,
None(),
- None(),
parentHooks);
if (errProcess.isError()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 0133628..c5007a3 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -734,28 +734,6 @@ Future<hashset<ContainerID>> DockerContainerizer::containers()
}
-// A Subprocess async-safe "setup" helper used by
-// DockerContainerizerProcess when launching the mesos-docker-executor
-// that does a 'setsid' and then synchronizes with the parent.
-static int setup(const string& directory)
-{
- // Put child into its own process session to prevent slave suicide
- // on child process SIGKILL/SIGTERM.
- if (::setsid() == -1) {
- return errno;
- }
-
- // Run the process in the specified directory.
- if (!directory.empty()) {
- if (::chdir(directory.c_str()) == -1) {
- return errno;
- }
- }
-
- return 0;
-}
-
-
Future<Nothing> DockerContainerizerProcess::recover(
const Option<SlaveState>& state)
{
@@ -1238,11 +1216,12 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
Subprocess::PIPE(),
subprocessInfo.out,
subprocessInfo.err,
+ SETSID,
dockerFlags(flags, container->name(), container->directory),
environment,
- lambda::bind(&setup, container->directory),
None(),
- parentHooks);
+ parentHooks,
+ container->directory);
if (s.isError()) {
return Failure("Failed to fork executor: " + s.error());
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/external_containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.cpp b/src/slave/containerizer/external_containerizer.cpp
index fe368dd..cf4384c 100644
--- a/src/slave/containerizer/external_containerizer.cpp
+++ b/src/slave/containerizer/external_containerizer.cpp
@@ -1045,33 +1045,6 @@ void ExternalContainerizerProcess::unwait(const ContainerID& containerId)
}
-// Post fork, pre exec function.
-// TODO(tillt): Consider having the kernel notify us when our parent
-// process dies e.g. by invoking prctl(PR_SET_PDEATHSIG, ..) on linux.
-static int setup(const string& directory)
-{
- // Put child into its own process session to prevent slave suicide
- // on child process SIGKILL/SIGTERM.
- if (::setsid() == -1) {
- return errno;
- }
-
- // Re/establish the sandbox conditions for the containerizer.
- if (!directory.empty()) {
- if (::chdir(directory.c_str()) == -1) {
- return errno;
- }
- }
-
- // Sync parent and child process.
- int sync = 0;
- while (::write(STDOUT_FILENO, &sync, sizeof(sync)) == -1 &&
- errno == EINTR);
-
- return 0;
-}
-
-
Try<Subprocess> ExternalContainerizerProcess::invoke(
const string& command,
const Option<Sandbox>& sandbox,
@@ -1114,26 +1087,24 @@ Try<Subprocess> ExternalContainerizerProcess::invoke(
// Fork exec of external process. Run a chdir and a setsid within
// the child-context.
+ // TODO(tillt): Consider having the kernel notify us when our parent
+ // process dies e.g. by invoking prctl(PR_SET_PDEATHSIG, ..) on linux.
Try<Subprocess> external = process::subprocess(
execute,
Subprocess::PIPE(),
Subprocess::PIPE(),
Subprocess::PIPE(),
+ process::SETSID,
environment,
- lambda::bind(&setup, sandbox.isSome() ? sandbox.get().directory
- : string()));
+ None(),
+ Subprocess::Hook::None(),
+ sandbox.isSome() ? Option<string>::some(sandbox->directory) : None());
if (external.isError()) {
return Error("Failed to execute external containerizer: " +
external.error());
}
- // Sync parent and child process to make sure we have done the
- // setsid within the child context before continuing.
- int sync;
- while (::read(external.get().out().get(), &sync, sizeof(sync)) == -1 &&
- errno == EINTR);
-
// Set stderr into non-blocking mode.
Try<Nothing> nonblock = os::nonblock(external.get().err().get());
if (nonblock.isError()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/fetcher.cpp b/src/slave/containerizer/fetcher.cpp
index 2b1e022..0992112 100644
--- a/src/slave/containerizer/fetcher.cpp
+++ b/src/slave/containerizer/fetcher.cpp
@@ -789,6 +789,7 @@ Future<Nothing> FetcherProcess::run(
Subprocess::PIPE(),
Subprocess::FD(out.get(), Subprocess::IO::OWNED),
Subprocess::FD(err.get(), Subprocess::IO::OWNED),
+ NO_SETSID,
environment);
if (fetcherSubprocess.isError()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index e7f7e7f..605c52e 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1127,7 +1127,6 @@ Future<bool> MesosContainerizerProcess::__launch(
: Subprocess::IO(subprocessInfo.err)),
launchFlags,
environment,
- None(),
namespaces); // 'namespaces' will be ignored by PosixLauncher.
if (forked.isError()) {
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/mesos/isolators/posix/disk.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/posix/disk.cpp b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
index b38d83f..f32c2c3 100644
--- a/src/slave/containerizer/mesos/isolators/posix/disk.cpp
+++ b/src/slave/containerizer/mesos/isolators/posix/disk.cpp
@@ -435,20 +435,6 @@ private:
Promise<Bytes> promise;
};
- // This function is invoked right before each 'du' is exec'ed. Note
- // that this function needs to be async signal safe.
- static int setupChild()
- {
-#ifdef __linux__
- // Kill the child process if the parent exits.
- // NOTE: This function should never returns non-zero because we
- // are passing in a valid signal.
- return ::prctl(PR_SET_PDEATHSIG, SIGKILL);
-#else
- return 0;
-#endif
- }
-
void discard(const string& path)
{
for (auto it = entries.begin(); it != entries.end(); ++it) {
@@ -501,15 +487,13 @@ private:
// Add path on which 'du' must be run.
command.push_back(entry->path);
+ // TODO(joerg84): Add correct killing behavior.
Try<Subprocess> s = subprocess(
"du",
command,
Subprocess::PATH("/dev/null"),
Subprocess::PIPE(),
- Subprocess::PIPE(),
- None(),
- None(),
- setupChild);
+ Subprocess::PIPE());
if (s.isError()) {
entry->promise.fail("Failed to exec 'du': " + s.error());
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/mesos/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.cpp b/src/slave/containerizer/mesos/launcher.cpp
index ba012b1..c37eee0 100644
--- a/src/slave/containerizer/mesos/launcher.cpp
+++ b/src/slave/containerizer/mesos/launcher.cpp
@@ -79,29 +79,6 @@ Future<hashset<ContainerID>> PosixLauncher::recover(
}
-// The setup function in child before the exec.
-static int childSetup(const Option<lambda::function<int()>>& setup)
-{
- // POSIX guarantees a forked child's pid does not match any existing
- // process group id so only a single setsid() is required and the
- // session id will be the pid.
- // TODO(idownes): perror is not listed as async-signal-safe and
- // should be reimplemented safely.
- // TODO(jieyu): Move this logic to the subprocess (i.e.,
- // mesos-containerizer launch).
- if (::setsid() == -1) {
- perror("Failed to put child in a new session");
- _exit(EXIT_FAILURE);
- }
-
- if (setup.isSome()) {
- return setup.get()();
- }
-
- return 0;
-}
-
-
Try<pid_t> PosixLauncher::fork(
const ContainerID& containerId,
const string& path,
@@ -111,7 +88,6 @@ Try<pid_t> PosixLauncher::fork(
const Subprocess::IO& err,
const Option<flags::FlagsBase>& flags,
const Option<map<string, string>>& environment,
- const Option<lambda::function<int()>>& setup,
const Option<int>& namespaces)
{
if (pids.contains(containerId)) {
@@ -134,9 +110,9 @@ Try<pid_t> PosixLauncher::fork(
in,
out,
err,
+ SETSID,
flags,
environment,
- lambda::bind(&childSetup, setup),
None(),
parentHooks);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/mesos/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launcher.hpp b/src/slave/containerizer/mesos/launcher.hpp
index 8afac20..63d642c 100644
--- a/src/slave/containerizer/mesos/launcher.hpp
+++ b/src/slave/containerizer/mesos/launcher.hpp
@@ -57,10 +57,8 @@ public:
// Fork a new process in the containerized context. The child will
// exec the binary at the given path with the given argv, flags and
// environment. The I/O of the child will be redirected according to
- // the specified I/O descriptors. The user can provide a 'setup'
- // function which will be invoked in the child process right before
- // the exec. The 'setup' function has to be async signal safe. The
- // parent will return the child's pid if the fork is successful.
+ // the specified I/O descriptors. The parent will return the child's
+ // pid if the fork is successful.
virtual Try<pid_t> fork(
const ContainerID& containerId,
const std::string& path,
@@ -70,7 +68,6 @@ public:
const process::Subprocess::IO& err,
const Option<flags::FlagsBase>& flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<lambda::function<int()>>& setup,
const Option<int>& namespaces) = 0;
// Kill all processes in the containerized context.
@@ -101,7 +98,6 @@ public:
const process::Subprocess::IO& err,
const Option<flags::FlagsBase>& flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<lambda::function<int()>>& setup,
const Option<int>& namespaces);
virtual process::Future<Nothing> destroy(const ContainerID& containerId);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/mesos/linux_launcher.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.cpp b/src/slave/containerizer/mesos/linux_launcher.cpp
index 550c582..7e82b0b 100644
--- a/src/slave/containerizer/mesos/linux_launcher.cpp
+++ b/src/slave/containerizer/mesos/linux_launcher.cpp
@@ -222,28 +222,6 @@ Future<hashset<ContainerID>> LinuxLauncher::recover(
}
-static int childSetup(const Option<lambda::function<int()>>& setup)
-{
- // Move to a different session (and new process group) so we're
- // independent from the slave's session (otherwise children will
- // receive SIGHUP if the slave exits).
- // TODO(idownes): perror is not listed as async-signal-safe and
- // should be reimplemented safely.
- // TODO(jieyu): Move this logic to the subprocess (i.e.,
- // mesos-containerizer launch).
- if (::setsid() == -1) {
- perror("Failed to put child in a new session");
- return 1;
- }
-
- if (setup.isSome()) {
- return setup.get()();
- }
-
- return 0;
-}
-
-
// A hook that is executed in the parent process. It attempts to move a process
// into the freezer cgroup.
//
@@ -294,7 +272,6 @@ Try<pid_t> LinuxLauncher::fork(
const process::Subprocess::IO& err,
const Option<flags::FlagsBase>& flags,
const Option<map<string, string>>& environment,
- const Option<lambda::function<int()>>& setup,
const Option<int>& namespaces)
{
int cloneFlags = namespaces.isSome() ? namespaces.get() : 0;
@@ -329,9 +306,9 @@ Try<pid_t> LinuxLauncher::fork(
in,
out,
err,
+ SETSID,
flags,
environment,
- lambda::bind(&childSetup, setup),
lambda::bind(&os::clone, lambda::_1, cloneFlags),
parentHooks);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/slave/containerizer/mesos/linux_launcher.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/linux_launcher.hpp b/src/slave/containerizer/mesos/linux_launcher.hpp
index 1763d8d..3a0f378 100644
--- a/src/slave/containerizer/mesos/linux_launcher.hpp
+++ b/src/slave/containerizer/mesos/linux_launcher.hpp
@@ -47,7 +47,6 @@ public:
const process::Subprocess::IO& err,
const Option<flags::FlagsBase>& flags,
const Option<std::map<std::string, std::string>>& environment,
- const Option<lambda::function<int()>>& setup,
const Option<int>& namespaces);
virtual process::Future<Nothing> destroy(const ContainerID& containerId);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/tests/containerizer/isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/isolator_tests.cpp b/src/tests/containerizer/isolator_tests.cpp
index df506fc..47fbd39 100644
--- a/src/tests/containerizer/isolator_tests.cpp
+++ b/src/tests/containerizer/isolator_tests.cpp
@@ -113,27 +113,6 @@ namespace mesos {
namespace internal {
namespace tests {
-static int childSetup(int pipes[2])
-{
- // In child process.
- ::close(pipes[1]);
-
- // Wait until the parent signals us to continue.
- char dummy;
- ssize_t length;
- while ((length = ::read(pipes[0], &dummy, sizeof(dummy))) == -1 &&
- errno == EINTR);
-
- if (length != sizeof(dummy)) {
- ABORT("Failed to synchronize with parent");
- }
-
- ::close(pipes[0]);
-
- return 0;
-}
-
-
template <typename T>
class CpuIsolatorTest : public MesosTest {};
@@ -148,7 +127,7 @@ typedef ::testing::Types<
TYPED_TEST_CASE(CpuIsolatorTest, CpuIsolatorTypes);
-
+// TODO(joerg84): Move isolate call to parentHook tests.
TYPED_TEST(CpuIsolatorTest, UserCpuUsage)
{
slave::Flags flags;
@@ -184,7 +163,7 @@ TYPED_TEST(CpuIsolatorTest, UserCpuUsage)
const string& file = path::join(dir.get(), "mesos_isolator_test_ready");
- // Max out a single core in userspace. This will run for at most one second.
+ // Max out a single core in userspace. This will run for at most onesecond.
string command = "while true ; do true ; done &"
"touch " + file + "; " // Signals the command is running.
"sleep 60";
@@ -204,6 +183,7 @@ TYPED_TEST(CpuIsolatorTest, UserCpuUsage)
Subprocess::FD(STDIN_FILENO),
Subprocess::FD(STDOUT_FILENO),
Subprocess::FD(STDERR_FILENO),
+ false,
None(),
None(),
lambda::bind(&childSetup, pipes),
@@ -296,7 +276,7 @@ TYPED_TEST(CpuIsolatorTest, SystemCpuUsage)
const string& file = path::join(dir.get(), "mesos_isolator_test_ready");
- // Generating random numbers is done by the kernel and will max out a single
+ // Generating random numbers is done by the kernel and will max out asingle
// core and run almost exclusively in the kernel, i.e., system time.
string command = "cat /dev/urandom > /dev/null & "
"touch " + file + "; " // Signals the command is running.
@@ -504,7 +484,6 @@ TEST_F(RevocableCpuIsolatorTest, ROOT_CGROUPS_RevocableCpu)
Subprocess::PATH("/dev/null"),
None(),
None(),
- None(),
None());
ASSERT_SOME(pid);
@@ -579,7 +558,7 @@ TEST_F(LimitedCpuIsolatorTest, ROOT_CGROUPS_CFS_Enable_Cfs)
// Generate random numbers to max out a single core. We'll run this for 0.5
// seconds of wall time so it should consume approximately 250 ms of total
- // cpu time when limited to 0.5 cpu. We use /dev/urandom to prevent blocking
+ // cpu time when limited to 0.5 cpu. We use /dev/urandom to preventblocking
// on Linux when there's insufficient entropy.
string command = "cat /dev/urandom > /dev/null & "
"export MESOS_TEST_PID=$! && "
@@ -630,7 +609,7 @@ TEST_F(LimitedCpuIsolatorTest, ROOT_CGROUPS_CFS_Enable_Cfs)
AWAIT_READY(usage);
// Expect that no more than 300 ms of cpu time has been consumed. We also
- // check that at least 50 ms of cpu time has been consumed so this test will
+ // check that at least 50 ms of cpu time has been consumed so this testwill
// fail if the host system is very heavily loaded. This behavior is correct
// because under such conditions we aren't actually testing the CFS cpu
// limiter.
@@ -1331,7 +1310,6 @@ TEST_F(SharedFilesystemIsolatorTest, DISABLED_ROOT_RelativeVolume)
Subprocess::FD(STDERR_FILENO),
None(),
None(),
- None(),
prepare.get().get().namespaces());
ASSERT_SOME(pid);
@@ -1438,7 +1416,6 @@ TEST_F(SharedFilesystemIsolatorTest, DISABLED_ROOT_AbsoluteVolume)
Subprocess::FD(STDERR_FILENO),
None(),
None(),
- None(),
prepare.get().get().namespaces());
ASSERT_SOME(pid);
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/tests/containerizer/launch_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/launch_tests.cpp b/src/tests/containerizer/launch_tests.cpp
index e0f934c..3e36f2f 100644
--- a/src/tests/containerizer/launch_tests.cpp
+++ b/src/tests/containerizer/launch_tests.cpp
@@ -78,9 +78,9 @@ public:
Subprocess::PATH("/dev/null"),
Subprocess::FD(STDOUT_FILENO),
Subprocess::FD(STDERR_FILENO),
+ NO_SETSID,
launchFlags,
None(),
- None(),
lambda::bind(&os::clone, lambda::_1, CLONE_NEWNS | SIGCHLD));
close(launchFlags.pipe_read.get());
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/tests/containerizer/launcher.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/launcher.cpp b/src/tests/containerizer/launcher.cpp
index a92d989..51ae4f9 100644
--- a/src/tests/containerizer/launcher.cpp
+++ b/src/tests/containerizer/launcher.cpp
@@ -30,7 +30,7 @@ ACTION_P(InvokeRecover, launcher)
ACTION_P(InvokeFork, launcher)
{
return launcher->real->fork(
- arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}
@@ -51,9 +51,9 @@ TestLauncher::TestLauncher(const process::Owned<slave::Launcher>& _real)
EXPECT_CALL(*this, recover(_))
.WillRepeatedly(DoDefault());
- ON_CALL(*this, fork(_, _, _, _, _, _, _, _, _, _))
+ ON_CALL(*this, fork(_, _, _, _, _, _, _, _, _))
.WillByDefault(InvokeFork(this));
- EXPECT_CALL(*this, fork(_, _, _, _, _, _, _, _, _, _))
+ EXPECT_CALL(*this, fork(_, _, _, _, _, _, _, _, _))
.WillRepeatedly(DoDefault());
ON_CALL(*this, destroy(_))
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/tests/containerizer/launcher.hpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/launcher.hpp b/src/tests/containerizer/launcher.hpp
index 36405a9..f7c4801 100644
--- a/src/tests/containerizer/launcher.hpp
+++ b/src/tests/containerizer/launcher.hpp
@@ -56,7 +56,7 @@ public:
process::Future<hashset<ContainerID>>(
const std::list<mesos::slave::ContainerState>& states));
- MOCK_METHOD10(
+ MOCK_METHOD9(
fork,
Try<pid_t>(
const ContainerID& containerId,
@@ -67,7 +67,6 @@ public:
const process::Subprocess::IO& err,
const Option<flags::FlagsBase>& flags,
const Option<std::map<std::string, std::string> >& env,
- const Option<lambda::function<int()> >& setup,
const Option<int>& namespaces));
MOCK_METHOD1(
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/tests/containerizer/ns_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/ns_tests.cpp b/src/tests/containerizer/ns_tests.cpp
index 4bf45e9..fef299f 100644
--- a/src/tests/containerizer/ns_tests.cpp
+++ b/src/tests/containerizer/ns_tests.cpp
@@ -91,7 +91,7 @@ TEST(NsTest, ROOT_setns)
Subprocess::FD(STDIN_FILENO),
Subprocess::FD(STDOUT_FILENO),
Subprocess::FD(STDERR_FILENO),
- None(),
+ NO_SETSID,
None(),
None(),
lambda::bind(&os::clone, lambda::_1, flags | SIGCHLD));
http://git-wip-us.apache.org/repos/asf/mesos/blob/5043f0d6/src/tests/slave_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_tests.cpp b/src/tests/slave_tests.cpp
index 1f1a310..57fc503 100644
--- a/src/tests/slave_tests.cpp
+++ b/src/tests/slave_tests.cpp
@@ -426,6 +426,7 @@ TEST_F(SlaveTest, CommandExecutorWithOverride)
Subprocess::PIPE(),
Subprocess::PIPE(),
Subprocess::PIPE(),
+ NO_SETSID,
environment);
ASSERT_SOME(executor);