You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/10/23 21:21:47 UTC

[1/5] git commit: Revert "Added memory threshold notifications for inducing OOMs."

Updated Branches:
  refs/heads/master e0a8f0a9d -> a538ec167


Revert "Added memory threshold notifications for inducing OOMs."

This reverts commit 8d742395b77cb9fb95cf5fdc123545aeb69f5c48.

Review: https://reviews.apache.org/r/14863


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/38254e79
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/38254e79
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/38254e79

Branch: refs/heads/master
Commit: 38254e7908f4576563d3bd21b861a51a02214e54
Parents: 8367d94
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Tue Oct 22 18:47:52 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Oct 23 12:14:01 2013 -0700

----------------------------------------------------------------------
 src/slave/cgroups_isolator.cpp | 108 ++++++++----------------------------
 src/slave/cgroups_isolator.hpp |   9 +--
 src/slave/flags.hpp            |  12 ----
 3 files changed, 23 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/38254e79/src/slave/cgroups_isolator.cpp
----------------------------------------------------------------------
diff --git a/src/slave/cgroups_isolator.cpp b/src/slave/cgroups_isolator.cpp
index fc36f1f..4be3448 100644
--- a/src/slave/cgroups_isolator.cpp
+++ b/src/slave/cgroups_isolator.cpp
@@ -672,11 +672,12 @@ void CgroupsIsolator::killExecutor(
   LOG(INFO) << "Killing executor " << executorId
             << " of framework " << frameworkId;
 
-  info->killed = true;
+  // Stop the OOM listener if needed.
+  if (info->oomNotifier.isPending()) {
+    info->oomNotifier.discard();
+  }
 
-  // Stop the OOM and threshold listeners.
-  info->oomNotifier.discard();
-  info->memoryThresholdNotifier.discard();
+  info->killed = true;
 
   // Destroy the cgroup that is associated with the executor. Here, we
   // don't wait for it to succeed as we don't want to block the
@@ -1072,8 +1073,6 @@ Try<Nothing> CgroupsIsolator::memChanged(
     return Error("Expecting resource 'mem' to be a scalar");
   }
 
-  // The soft limit is used as a threshold for inducing our own "OOM"s
-  // so that we can capture memory information for debugging purposes.
   Bytes mem = Bytes((uint64_t) resource.scalar().value() * 1024LL * 1024LL);
   Bytes limit = std::max(mem, MIN_MEMORY);
 
@@ -1090,7 +1089,7 @@ Try<Nothing> CgroupsIsolator::memChanged(
             << " for executor " << info->executorId
             << " of framework " << info->frameworkId;
 
-  // Determine the current hard limit.
+  // Read the existing limit.
   Try<Bytes> currentLimit =
     cgroups::memory::limit_in_bytes(hierarchy, info->name());
 
@@ -1099,10 +1098,6 @@ Try<Nothing> CgroupsIsolator::memChanged(
         "Failed to read 'memory.limit_in_bytes': " + currentLimit.error());
   }
 
-  // The hard limit has an additional memory buffer to allow us
-  // to induce our own OOM when the soft limit threshold is reached.
-  Bytes hardLimit = limit + flags.cgroups_oom_buffer;
-
   // Determine whether to set the hard limit. If this is the first
   // time (info->pid.isNone()), or we're raising the existing limit,
   // then we can update the hard limit safely. Otherwise, if we need
@@ -1113,43 +1108,16 @@ Try<Nothing> CgroupsIsolator::memChanged(
   // TODO(benh): Introduce a MemoryWatcherProcess which monitors the
   // discrepancy between usage and soft limit and introduces a
   // "manual oom" if necessary.
-  if (info->pid.isNone() || hardLimit > currentLimit.get()) {
-    // Set the memory hard limit.
-    write = cgroups::memory::limit_in_bytes(hierarchy, info->name(), hardLimit);
+  if (info->pid.isNone() || limit > currentLimit.get()) {
+    write = cgroups::memory::limit_in_bytes(hierarchy, info->name(), limit);
 
     if (write.isError()) {
       return Error("Failed to set 'memory.limit_in_bytes': " + write.error());
     }
 
-    LOG(INFO) << "Updated 'memory.limit_in_bytes' to " << hardLimit
+    LOG(INFO) << "Updated 'memory.limit_in_bytes' to " << limit
               << " for executor " << info->executorId
               << " of framework " << info->frameworkId;
-
-    // Update the memory threshold notification.
-    if (info->memoryThresholdNotifier.isPending()) {
-      // The threshold can be triggered while we go to discard it
-      // here, but that's ok. It's still an OOM!
-      info->memoryThresholdNotifier.discard();
-    }
-
-    // The new threshold notification should be created only if we
-    // were able to successfully discard it above.
-    if (info->memoryThresholdNotifier.isDiscarded()) {
-      info->memoryThresholdNotifier = cgroups::listen(
-          hierarchy,
-          info->name(),
-          "memory.usage_in_bytes",
-          stringify(limit.bytes()));
-
-      info->memoryThresholdNotifier.onAny(
-          defer(PID<CgroupsIsolator>(this),
-                &CgroupsIsolator::oomWaited,
-                info->frameworkId,
-                info->executorId,
-                info->uuid.get(),
-                "memory threshold (" + stringify(limit) + ")",
-                lambda::_1));
-    }
   }
 
   return Nothing();
@@ -1184,7 +1152,6 @@ void CgroupsIsolator::oomListen(
             frameworkId,
             executorId,
             info->uuid.get(),
-            "OOM",
             lambda::_1));
 }
 
@@ -1193,46 +1160,22 @@ void CgroupsIsolator::oomWaited(
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,
     const UUID& uuid,
-    const string& event,
     const Future<uint64_t>& future)
 {
+  LOG(INFO) << "OOM notifier is triggered for executor "
+            << executorId << " of framework " << frameworkId
+            << " with uuid " << uuid;
+
   if (future.isDiscarded()) {
-    LOG(INFO) << "Discarded " << event << " notifier for executor "
+    LOG(INFO) << "Discarded OOM notifier for executor "
               << executorId << " of framework " << frameworkId
               << " with uuid " << uuid;
   } else if (future.isFailed()) {
-    LOG(ERROR) << "Failed to listen to " << event << " events for executor "
+    LOG(ERROR) << "Listening on OOM events failed for executor "
                << executorId << " of framework " << frameworkId
                << " with uuid " << uuid << ": " << future.failure();
   } else {
-    CgroupInfo* info = findCgroupInfo(frameworkId, executorId);
-
-    if (info == NULL) {
-      LOG(WARNING) << event << " handler invoked for the already terminated "
-                   << "executor " << executorId
-                   << " of framework " << frameworkId
-                   << " with uuid " << uuid;
-      return;
-    }
-
-    if (info->killed) {
-      LOG(WARNING) << "Ignoring " << event << " notification for the killed "
-                   << "executor " << executorId
-                   << " of framework " << frameworkId
-                   << " with uuid " << uuid;
-      return;
-    }
-
-    LOG(INFO) << event << " event detected for executor " << executorId
-              << " of framework " << frameworkId << " with uuid " << uuid
-              << " ; invoking OOM handler";
-
-    // Discard both notifiers. If either an OOM occurs or the memory
-    // threshold is reached, we're treating it as an OOM and no longer
-    // need to be notified.
-    info->memoryThresholdNotifier.discard();
-    info->oomNotifier.discard();
-
+    // Out-of-memory event happened, call the handler.
     oom(frameworkId, executorId, uuid);
   }
 }
@@ -1248,9 +1191,7 @@ void CgroupsIsolator::oom(
     // It is likely that processExited is executed before this function (e.g.
     // The kill and OOM events happen at the same time, and the process exit
     // event arrives first.) Therefore, we should not report a fatal error here.
-    LOG(WARNING) << "OOM handler invoked for the already terminated executor "
-                 << executorId << " of framework " << frameworkId
-                 << " with uuid " << uuid;
+    LOG(INFO) << "OOM detected for an already terminated executor";
     return;
   }
 
@@ -1258,18 +1199,15 @@ void CgroupsIsolator::oom(
   // previous instance of an executor.
   CHECK_SOME(info->uuid);
   if (uuid != info->uuid.get()) {
-    LOG(WARNING) << "OOM handler invoked for the previous executor instance "
-                 << executorId << " of framework " << frameworkId
-                 << " with uuid " << uuid
-                 << " vs current uuid " << info->uuid.get();
+    LOG(INFO) << "OOM detected for a previous executor instance";
     return;
   }
 
   // If killed is set, the OOM notifier will be discarded in oomWaited.
   // Therefore, we should not be able to reach this point.
-  CHECK(!info->killed) << "OOM handler invoked for an already killed executor";
+  CHECK(!info->killed) << "OOM detected for an already killed executor";
 
-  LOG(INFO) << "OOM handler invoked for executor " << executorId
+  LOG(INFO) << "OOM detected for executor " << executorId
             << " of framework " << frameworkId
             << " with uuid " << uuid;
 
@@ -1279,12 +1217,10 @@ void CgroupsIsolator::oom(
   message << "Memory limit exceeded: ";
 
   // Output the requested memory limit.
-  Try<Bytes> limit = cgroups::memory::soft_limit_in_bytes(
-      hierarchy, info->name());
+  Try<Bytes> limit = cgroups::memory::limit_in_bytes(hierarchy, info->name());
 
   if (limit.isError()) {
-    LOG(ERROR) << "Failed to read 'memory.soft_limit_in_bytes': "
-               << limit.error();
+    LOG(ERROR) << "Failed to read 'memory.limit_in_bytes': " << limit.error();
   } else {
     message << "Requested: " << limit.get() << " ";
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/38254e79/src/slave/cgroups_isolator.hpp
----------------------------------------------------------------------
diff --git a/src/slave/cgroups_isolator.hpp b/src/slave/cgroups_isolator.hpp
index ca3e1ae..e86062e 100644
--- a/src/slave/cgroups_isolator.hpp
+++ b/src/slave/cgroups_isolator.hpp
@@ -172,9 +172,6 @@ private:
     // Used to cancel the OOM listening.
     process::Future<uint64_t> oomNotifier;
 
-    // Used to cancel the memory threshold listening.
-    process::Future<uint64_t> memoryThresholdNotifier;
-
     // CPUs allocated if using 'cpuset' subsystem.
     Cpuset* cpuset;
   };
@@ -225,17 +222,13 @@ private:
   // @param   frameworkId   The id of the given framework.
   // @param   executorId    The id of the given executor.
   // @param   uuid          The uuid of the given executor.
-  // @param   event         The OOM event type name:
-  //                          "OOM" or "memory threshold ({Bytes})".
   void oomWaited(
       const FrameworkID& frameworkId,
       const ExecutorID& executorId,
       const UUID& uuid,
-      const std::string& event,
       const process::Future<uint64_t>& future);
 
-  // This function is invoked to process an executor that has
-  // OOMed or exceeded its memory limit.
+  // This function is invoked when the OOM event happens.
   // @param   frameworkId   The id of the given framework.
   // @param   executorId    The id of the given executor.
   // @param   uuid          The uuid of the given executor.

http://git-wip-us.apache.org/repos/asf/mesos/blob/38254e79/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index db777e3..ea1e4f7 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -21,7 +21,6 @@
 
 #include <string>
 
-#include <stout/bytes.hpp>
 #include <stout/duration.hpp>
 #include <stout/flags.hpp>
 #include <stout/option.hpp>
@@ -180,16 +179,6 @@ public:
         "Cgroups feature flag to enable hard limits on CPU resources\n"
         "via the CFS bandwidth limiting subfeature.\n",
         false);
-
-    add(&Flags::cgroups_oom_buffer,
-        "cgroups_oom_buffer",
-        "Additional memory alloted to executors in order to allow mesos\n"
-        "to soft-kill the executor prior to the kernel placing it under OOM.\n"
-        "(e.g. 128MB)\n"
-        "NOTE: This was added to compensate for a bug in the Linux kernel\n"
-        "      that causes the system to lock up when the oom_killer is\n"
-        "      disabled.",
-        Megabytes(128));
 #endif
   }
 
@@ -215,7 +204,6 @@ public:
   std::string cgroups_root;
   std::string cgroups_subsystems;
   bool cgroups_enable_cfs;
-  Bytes cgroups_oom_buffer;
 #endif
 };
 


[4/5] git commit: Revert "Added a missing include."

Posted by bm...@apache.org.
Revert "Added a missing include."

This reverts commit b9e6ce6e9ccbf08ae8a6a666c09391b407a3d82a.

Review: https://reviews.apache.org/r/14861


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/be9c22f9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/be9c22f9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/be9c22f9

Branch: refs/heads/master
Commit: be9c22f9b8cb7b8087fb205eee1c6b2e5956c77e
Parents: b347190
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Tue Oct 22 18:45:28 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Oct 23 12:14:01 2013 -0700

----------------------------------------------------------------------
 src/tests/script.cpp | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/be9c22f9/src/tests/script.cpp
----------------------------------------------------------------------
diff --git a/src/tests/script.cpp b/src/tests/script.cpp
index 47dbfde..aa82f78 100644
--- a/src/tests/script.cpp
+++ b/src/tests/script.cpp
@@ -16,7 +16,6 @@
  * limitations under the License.
  */
 
-#include <limits.h> // For ARG_MAX.
 #include <signal.h> // For strsignal.
 #include <stdio.h>  // For freopen.
 #include <string.h> // For strlen, strerror.


[5/5] git commit: Fixed mesos.pom to work from inside the build directory.

Posted by bm...@apache.org.
Fixed mesos.pom to work from inside the build directory.

Review: https://reviews.apache.org/r/14706


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a538ec16
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a538ec16
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a538ec16

Branch: refs/heads/master
Commit: a538ec1678f0af040c449e8e926bca8ddcbe5982
Parents: 38254e7
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Wed Oct 16 17:49:20 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Oct 23 12:17:50 2013 -0700

----------------------------------------------------------------------
 src/java/mesos.pom.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a538ec16/src/java/mesos.pom.in
----------------------------------------------------------------------
diff --git a/src/java/mesos.pom.in b/src/java/mesos.pom.in
index b88079d..f817c94 100644
--- a/src/java/mesos.pom.in
+++ b/src/java/mesos.pom.in
@@ -87,7 +87,7 @@
     </dependency>
   </dependencies>
   <build>
-    <sourceDirectory>${basedir}/src</sourceDirectory>
+    <sourceDirectory>@abs_top_srcdir@/src/java/src</sourceDirectory>
     <resources>
       <resource>
         <directory>${basedir}/classes</directory>
@@ -127,7 +127,7 @@
       <plugin>
         <artifactId>maven-javadoc-plugin</artifactId>
         <configuration>
-          <sourcepath>src</sourcepath>
+          <sourcepath>@abs_top_srcdir@/src/java/src</sourcepath>
           <subpackages>org.apache.mesos</subpackages>
         </configuration>
         <executions>


[3/5] git commit: Revert "Fixed ARG_MAX compilation issue on some POSIX systems."

Posted by bm...@apache.org.
Revert "Fixed ARG_MAX compilation issue on some POSIX systems."

This reverts commit d8da5f4d17d3a673beb5b76d0a7370bdda99c51d.

Review: https://reviews.apache.org/r/14860


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b347190b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b347190b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b347190b

Branch: refs/heads/master
Commit: b347190b58b98e6ab089573e78c308c8976dba6c
Parents: e0a8f0a
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Tue Oct 22 18:45:25 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Oct 23 12:14:01 2013 -0700

----------------------------------------------------------------------
 src/tests/script.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b347190b/src/tests/script.cpp
----------------------------------------------------------------------
diff --git a/src/tests/script.cpp b/src/tests/script.cpp
index e6a935f..47dbfde 100644
--- a/src/tests/script.cpp
+++ b/src/tests/script.cpp
@@ -16,10 +16,10 @@
  * limitations under the License.
  */
 
+#include <limits.h> // For ARG_MAX.
 #include <signal.h> // For strsignal.
 #include <stdio.h>  // For freopen.
 #include <string.h> // For strlen, strerror.
-#include <unistd.h> // For sysconf.
 
 #include <sys/wait.h> // For wait (and associated macros).
 
@@ -45,10 +45,7 @@ namespace tests {
 
 void execute(const string& script, const vector<string>& arguments)
 {
-  static long maximumArguments = sysconf(_SC_ARG_MAX);
-  PCHECK(maximumArguments != -1);
-
-  CHECK_LT(arguments.size(), static_cast<size_t>(maximumArguments));
+  CHECK_LT(arguments.size(), static_cast<size_t>(ARG_MAX));
 
   // Create a temporary directory for the test.
   Try<string> directory = environment->mkdtemp();


[2/5] git commit: Revert "Updated the balloon tests to test the memory threshold."

Posted by bm...@apache.org.
Revert "Updated the balloon tests to test the memory threshold."

This reverts commit ebba5c109d17fac2a18c16467097846f398e7217.

Conflicts:
	src/examples/balloon_framework.cpp
	src/tests/script.cpp

Review: https://reviews.apache.org/r/14862


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8367d94e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8367d94e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8367d94e

Branch: refs/heads/master
Commit: 8367d94e2184dd5777606f4edc66d39a514b9a7e
Parents: be9c22f
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Tue Oct 22 18:47:49 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Oct 23 12:14:01 2013 -0700

----------------------------------------------------------------------
 src/examples/balloon_executor.cpp    | 54 +++++++++++++++----------------
 src/examples/balloon_framework.cpp   | 50 ++++++++++++----------------
 src/tests/balloon_framework_test.sh  | 11 ++-----
 src/tests/cgroups_isolator_tests.cpp | 37 +++------------------
 src/tests/examples_tests.cpp         | 12 +++----
 src/tests/script.cpp                 | 17 ++--------
 src/tests/script.hpp                 | 39 +++-------------------
 7 files changed, 63 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/examples/balloon_executor.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_executor.cpp b/src/examples/balloon_executor.cpp
index 358afaf..ad1d861 100644
--- a/src/examples/balloon_executor.cpp
+++ b/src/examples/balloon_executor.cpp
@@ -26,50 +26,51 @@
 
 #include <iostream>
 #include <string>
-#include <vector>
 
 #include <mesos/executor.hpp>
 
-#include <stout/bytes.hpp>
 #include <stout/duration.hpp>
 #include <stout/numify.hpp>
 #include <stout/os.hpp>
 
 using namespace mesos;
 
-using std::string;
-using std::vector;
+
+// The amount of memory in MB each balloon step consumes.
+const static size_t BALLOON_STEP_MB = 64;
 
 
 // This function will increase the memory footprint gradually. The parameter
-// limit specifies the upper limit of the memory footprint. The
-// parameter step specifies the step size.
-static void balloon(const Bytes& limit, const Bytes& step)
+// limit specifies the upper limit (in MB) of the memory footprint. The
+// parameter step specifies the step size (in MB).
+static void balloon(size_t limit)
 {
-  for (size_t i = 0; i < limit.bytes() / step.bytes(); i++) {
-    std::cout << "Increasing memory footprint by " << step << std::endl;
+  size_t chunk = BALLOON_STEP_MB * 1024 * 1024;
+  for (size_t i = 0; i < limit / BALLOON_STEP_MB; i++) {
+    std::cout << "Increasing memory footprint by "
+              << BALLOON_STEP_MB << " MB" << std::endl;
 
     // Allocate page-aligned virtual memory.
     void* buffer = NULL;
-    if (posix_memalign(&buffer, getpagesize(), step.bytes()) != 0) {
+    if (posix_memalign(&buffer, getpagesize(), chunk) != 0) {
       perror("Failed to allocate page-aligned memory, posix_memalign");
       abort();
     }
 
     // We use mlock and memset here to make sure that the memory
     // actually gets paged in and thus accounted for.
-    if (mlock(buffer, step.bytes()) != 0) {
+    if (mlock(buffer, chunk) != 0) {
       perror("Failed to lock memory, mlock");
       abort();
     }
 
-    if (memset(buffer, 1, step.bytes()) != buffer) {
+    if (memset(buffer, 1, chunk) != buffer) {
       perror("Failed to fill memory, memset");
       abort();
     }
 
     // Try not to increase the memory footprint too fast.
-    os::sleep(Milliseconds(50));
+    os::sleep(Seconds(1));
   }
 }
 
@@ -108,21 +109,18 @@ public:
 
     driver->sendStatusUpdate(status);
 
-    // Get the balloon step and limit.
-    vector<string> split = strings::split(task.data(), ",");
-
-    Try<Bytes> step = Bytes::parse(split[0]);
-    assert(step.isSome());
-
-    Try<Bytes> limit = Bytes::parse(split[1]);
+    // Get the balloon limit (in MB).
+    Try<size_t> limit = numify<size_t>(task.data());
     assert(limit.isSome());
+    size_t balloonLimit = limit.get();
 
-    // Artificially increase the memory usage gradually. The limit
-    // can be larger than the amount of memory allocated to this
-    // executor. In that case, the isolator (e.g. cgroups) should be
-    // able to detect that and the task should not be able to reach
-    // TASK_FINISHED state.
-    balloon(limit.get(), step.get());
+    // Artificially increase the memory usage gradually. The
+    // balloonLimit specifies the upper limit. The balloonLimit can be
+    // larger than the amount of memory allocated to this executor. In
+    // that case, the isolator (e.g. cgroups) should be able to detect
+    // that and the task should not be able to reach TASK_FINISHED
+    // state.
+    balloon(balloonLimit);
 
     std::cout << "Finishing task " << task.task_id().value() << std::endl;
 
@@ -137,7 +135,7 @@ public:
     std::cout << "Kill task " << taskId.value() << std::endl;
   }
 
-  virtual void frameworkMessage(ExecutorDriver* driver, const string& data)
+  virtual void frameworkMessage(ExecutorDriver* driver, const std::string& data)
   {
     std::cout << "Framework message: " << data << std::endl;
   }
@@ -147,7 +145,7 @@ public:
     std::cout << "Shutdown" << std::endl;
   }
 
-  virtual void error(ExecutorDriver* driver, const string& message)
+  virtual void error(ExecutorDriver* driver, const std::string& message)
   {
     std::cout << "Error message: " << message << std::endl;
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/examples/balloon_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/balloon_framework.cpp b/src/examples/balloon_framework.cpp
index f5eda5e..d7abf1f 100644
--- a/src/examples/balloon_framework.cpp
+++ b/src/examples/balloon_framework.cpp
@@ -28,8 +28,6 @@
 
 #include <mesos/scheduler.hpp>
 
-#include <stout/bytes.hpp>
-#include <stout/exit.hpp>
 #include <stout/numify.hpp>
 #include <stout/os.hpp>
 #include <stout/stringify.hpp>
@@ -46,18 +44,15 @@ using std::endl;
 using std::string;
 
 // The amount of memory in MB the executor itself takes.
-const static Bytes EXECUTOR_MEMORY = Megabytes(64);
+const static size_t EXECUTOR_MEMORY_MB = 64;
 
 
 class BalloonScheduler : public Scheduler
 {
 public:
-  BalloonScheduler(
-      const ExecutorInfo& _executor,
-      const Bytes& _balloonStep,
-      const Bytes& _balloonLimit)
+  BalloonScheduler(const ExecutorInfo& _executor,
+                   size_t _balloonLimit)
     : executor(_executor),
-      balloonStep(_balloonStep),
       balloonLimit(_balloonLimit),
       taskLaunched(false) {}
 
@@ -91,7 +86,7 @@ public:
       // We just launch one task.
       if (!taskLaunched) {
         double mem = getScalarResource(offer, "mem");
-        assert(mem > EXECUTOR_MEMORY.megabytes());
+        assert(mem > EXECUTOR_MEMORY_MB);
 
         std::vector<TaskInfo> tasks;
         std::cout << "Starting the task" << std::endl;
@@ -101,15 +96,14 @@ public:
         task.mutable_task_id()->set_value("1");
         task.mutable_slave_id()->MergeFrom(offer.slave_id());
         task.mutable_executor()->MergeFrom(executor);
-        task.set_data(stringify(balloonStep) + "," + stringify(balloonLimit));
+        task.set_data(stringify<size_t>(balloonLimit));
 
         // Use up all the memory from the offer.
         Resource* resource;
         resource = task.add_resources();
         resource->set_name("mem");
         resource->set_type(Value::SCALAR);
-        resource->mutable_scalar()->set_value(
-            mem - EXECUTOR_MEMORY.megabytes());
+        resource->mutable_scalar()->set_value(mem - EXECUTOR_MEMORY_MB);
 
         tasks.push_back(task);
         driver->launchTasks(offer.id(), tasks);
@@ -171,33 +165,29 @@ public:
 
 private:
   const ExecutorInfo executor;
-  const Bytes balloonStep;
-  const Bytes balloonLimit;
+  const size_t balloonLimit;
   bool taskLaunched;
 };
 
 
 int main(int argc, char** argv)
 {
-  if (argc != 4) {
-    EXIT(1) << "Usage: " << argv[0]
-            << " <master> <balloon step> <balloon limit>";
+  if (argc != 3) {
+    std::cerr << "Usage: " << argv[0]
+              << " <master> <balloon limit in MB>" << std::endl;
+    return -1;
   }
 
-  // Parse the balloon step.
-  Try<Bytes> step = Bytes::parse(argv[2]);
-  if (step.isError()) {
-    EXIT(1) << "Balloon memory step is invalid: " << step.error();
-  }
-
-  // Parse the balloon limit.
-  Try<Bytes> limit = Bytes::parse(argv[3]);
+  // Verify the balloon limit.
+  Try<size_t> limit = numify<size_t>(argv[2]);
   if (limit.isError()) {
-    EXIT(1) << "Balloon memory limit is invalid: " << limit.error();
+    std::cerr << "Balloon limit is not a valid number" << std::endl;
+    return -1;
   }
 
-  if (limit.get() < EXECUTOR_MEMORY) {
-    EXIT(1) << "Please use an executor limit smaller than " << EXECUTOR_MEMORY;
+  if (limit.get() < EXECUTOR_MEMORY_MB) {
+    std::cerr << "Please use a balloon limit bigger than "
+              << EXECUTOR_MEMORY_MB << " MB" << std::endl;
   }
 
   // Find this executable's directory to locate executor.
@@ -216,9 +206,9 @@ int main(int argc, char** argv)
   Resource* mem = executor.add_resources();
   mem->set_name("mem");
   mem->set_type(Value::SCALAR);
-  mem->mutable_scalar()->set_value(EXECUTOR_MEMORY.megabytes());
+  mem->mutable_scalar()->set_value(EXECUTOR_MEMORY_MB);
 
-  BalloonScheduler scheduler(executor, step.get(), limit.get());
+  BalloonScheduler scheduler(executor, limit.get());
 
   FrameworkInfo framework;
   framework.set_user(""); // Have Mesos fill in the current user.

http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/tests/balloon_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/balloon_framework_test.sh b/src/tests/balloon_framework_test.sh
index 33946a5..213743f 100755
--- a/src/tests/balloon_framework_test.sh
+++ b/src/tests/balloon_framework_test.sh
@@ -3,12 +3,6 @@
 # This script runs the balloon framework on a cluster using the cgroups
 # isolator and checks that the framework returns a status of 1.
 
-if [ $# -ne 3 ]; then
-  echo "usage: `basename $0` cgroups_oom_buffer balloon_step balloon_limit"
-  echo "example: `basename $0` 127MB 32MB 1GB"
-  exit 1
-fi
-
 source ${MESOS_SOURCE_DIR}/support/colors.sh
 source ${MESOS_SOURCE_DIR}/support/atexit.sh
 
@@ -96,8 +90,7 @@ ${SLAVE} \
     --isolation=cgroups \
     --cgroups_hierarchy=${TEST_CGROUP_HIERARCHY} \
     --cgroups_root=${TEST_CGROUP_ROOT} \
-    --resources="cpus:1;mem:96" \
-    --cgroups_oom_buffer=${1} &
+    --resources="cpus:1;mem:96" &
 SLAVE_PID=${!}
 echo "${GREEN}Launched slave at ${SLAVE_PID}${NORMAL}"
 sleep 2
@@ -111,7 +104,7 @@ if [[ ${STATUS} -ne 0 ]]; then
 fi
 
 # The main event!
-${BALLOON_FRAMEWORK} localhost:5432 ${2} ${3}
+${BALLOON_FRAMEWORK} localhost:5432 1024
 STATUS=${?}
 
 # Make sure the balloon framework "failed".

http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/tests/cgroups_isolator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cgroups_isolator_tests.cpp b/src/tests/cgroups_isolator_tests.cpp
index cdac4a9..1f5ce76 100644
--- a/src/tests/cgroups_isolator_tests.cpp
+++ b/src/tests/cgroups_isolator_tests.cpp
@@ -35,39 +35,10 @@ using namespace mesos::internal::slave;
 
 using std::map;
 
-// Run the balloon framework under the cgroups isolator with a few
-// configurations.
-
-// No memory buffer on the slave.
-// Step with 64MB, limit 1GB.
-// This should behave as if there's only a hard threshold.
-TEST_SCRIPT_3(CgroupsIsolatorTest,
-              ROOT_CGROUPS_BalloonFramework_NoBuffer,
-              "balloon_framework_test.sh",
-              stringify(Megabytes(0)),
-              stringify(Megabytes(64)),
-              stringify(Gigabytes(1)))
-
-
-// 128MB memory buffer on the slave, step with 32 MB, limit 1GB.
-// This ensures we'll have time to act on the threshold notification.
-TEST_SCRIPT_3(CgroupsIsolatorTest,
-              ROOT_CGROUPS_BalloonFramework_Threshold,
-              "balloon_framework_test.sh",
-              stringify(Megabytes(128)),
-              stringify(Megabytes(32)),
-              stringify(Gigabytes(1)))
-
-
-// 1MB memory buffer on the slave, step with 64 MB, limit 1GB.
-// This ensures the OOM occurs before we can act on the threshold
-// notification.
-TEST_SCRIPT_3(CgroupsIsolatorTest,
-              ROOT_CGROUPS_BalloonFramework_OOM,
-              "balloon_framework_test.sh",
-              stringify(Megabytes(1)),
-              stringify(Megabytes(128)),
-              stringify(Gigabytes(1)))
+// Run the balloon framework under the cgroups isolator.
+TEST_SCRIPT(CgroupsIsolatorTest,
+            ROOT_CGROUPS_BalloonFramework,
+            "balloon_framework_test.sh")
 
 
 #define GROW_USAGE(delta, cpuset, usage)                                   \

http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/tests/examples_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/examples_tests.cpp b/src/tests/examples_tests.cpp
index d7429bb..28ff0f3 100644
--- a/src/tests/examples_tests.cpp
+++ b/src/tests/examples_tests.cpp
@@ -22,16 +22,14 @@
 
 
 // Run each of the sample frameworks in local mode.
-TEST_SCRIPT_0(ExamplesTest, TestFramework, "test_framework_test.sh")
-TEST_SCRIPT_0(ExamplesTest,
-              NoExecutorFramework,
-              "no_executor_framework_test.sh")
+TEST_SCRIPT(ExamplesTest, TestFramework, "test_framework_test.sh")
+TEST_SCRIPT(ExamplesTest, NoExecutorFramework, "no_executor_framework_test.sh")
 
 #ifdef MESOS_HAS_JAVA
-TEST_SCRIPT_0(ExamplesTest, JavaFramework, "java_framework_test.sh")
-TEST_SCRIPT_0(ExamplesTest, JavaException, "java_exception_test.sh")
+TEST_SCRIPT(ExamplesTest, JavaFramework, "java_framework_test.sh")
+TEST_SCRIPT(ExamplesTest, JavaException, "java_exception_test.sh")
 #endif
 
 #ifdef MESOS_HAS_PYTHON
-TEST_SCRIPT_0(ExamplesTest, PythonFramework, "python_framework_test.sh")
+TEST_SCRIPT(ExamplesTest, PythonFramework, "python_framework_test.sh")
 #endif

http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/tests/script.cpp
----------------------------------------------------------------------
diff --git a/src/tests/script.cpp b/src/tests/script.cpp
index aa82f78..b3bbf87 100644
--- a/src/tests/script.cpp
+++ b/src/tests/script.cpp
@@ -23,7 +23,6 @@
 #include <sys/wait.h> // For wait (and associated macros).
 
 #include <string>
-#include <vector>
 
 #include <stout/check.hpp>
 #include <stout/os.hpp>
@@ -36,16 +35,13 @@
 #include "tests/script.hpp"
 
 using std::string;
-using std::vector;
 
 namespace mesos {
 namespace internal {
 namespace tests {
 
-void execute(const string& script, const vector<string>& arguments)
+void execute(const string& script)
 {
-  CHECK_LT(arguments.size(), static_cast<size_t>(ARG_MAX));
-
   // Create a temporary directory for the test.
   Try<string> directory = environment->mkdtemp();
 
@@ -128,17 +124,8 @@ void execute(const string& script, const vector<string>& arguments)
     os::setenv("DEFAULT_PRINCIPAL", DEFAULT_CREDENTIAL.principal());
     os::setenv("DEFAULT_SECRET", DEFAULT_CREDENTIAL.secret());
 
-    // Construct the argument array.
-    const char** args = (const char**) new char*[arguments.size() + 1];
-    args[0] = path.get().c_str();
-    size_t index = 1;
-    foreach (const string& argument, arguments) {
-      args[index++] = argument.c_str();
-    }
-    args[arguments.size() + 1] = NULL;
-
     // Now execute the script.
-    execv(path.get().c_str(), (char* const*) args);
+    execl(path.get().c_str(), path.get().c_str(), (char*) NULL);
 
     std::cerr << "Failed to execute '" << script << "': "
               << strerror(errno) << std::endl;

http://git-wip-us.apache.org/repos/asf/mesos/blob/8367d94e/src/tests/script.hpp
----------------------------------------------------------------------
diff --git a/src/tests/script.hpp b/src/tests/script.hpp
index 980df20..f0c71e1 100644
--- a/src/tests/script.hpp
+++ b/src/tests/script.hpp
@@ -21,19 +21,12 @@
 
 #include <gtest/gtest.h>
 
-#include <string>
-#include <vector>
-
-#include <stout/preprocessor.hpp>
-
 namespace mesos {
 namespace internal {
 namespace tests {
 
 // Helper used by TEST_SCRIPT to execute the script.
-void execute(
-    const std::string& script,
-    const std::vector<std::string>& arguments = std::vector<std::string>());
+void execute(const std::string& script);
 
 } // namespace tests {
 } // namespace internal {
@@ -44,33 +37,9 @@ void execute(
 // script in temporary directory and pipe its output to '/dev/null'
 // unless the verbose option is specified. The "test" passes if the
 // script returns 0.
-#define TEST_SCRIPT_0(test_case_name, test_name, script)               \
-  TEST(test_case_name, test_name) {                                    \
-    mesos::internal::tests::execute(script);                           \
-  }
-
-#define TEST_SCRIPT_1(test_case_name, test_name, script, arg1)         \
-  TEST(test_case_name, test_name) {                                    \
-    std::vector<std::string> arguments;                                \
-    arguments.push_back(arg1);                                         \
-    mesos::internal::tests::execute(script, arguments);                \
-  }
-
-#define TEST_SCRIPT_2(test_case_name, test_name, script, arg1, arg2)   \
-  TEST(test_case_name, test_name) {                                    \
-    std::vector<std::string> arguments;                                \
-    arguments.push_back(arg1);                                         \
-    arguments.push_back(arg2);                                         \
-    mesos::internal::tests::execute(script, arguments);                \
-  }
-
-#define TEST_SCRIPT_3(test_case_name, test_name, script, arg1, arg2, arg3)   \
-  TEST(test_case_name, test_name) {                                          \
-    std::vector<std::string> arguments;                                      \
-    arguments.push_back(arg1);                                               \
-    arguments.push_back(arg2);                                               \
-    arguments.push_back(arg3);                                               \
-    mesos::internal::tests::execute(script, arguments);                      \
+#define TEST_SCRIPT(test_case_name, test_name, script)      \
+  TEST(test_case_name, test_name) {                         \
+    mesos::internal::tests::execute(script);                \
   }
 
 #endif // __TESTS_SCRIPT_HPP__