You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2018/02/05 16:01:56 UTC

[1/6] mesos git commit: Fixed race condition in IOSwitchboard for ATTACH_CONTAINER_INPUT call.

Repository: mesos
Updated Branches:
  refs/heads/1.5.x 8a9f99e9f -> c336fafa7


Fixed race condition in IOSwitchboard for ATTACH_CONTAINER_INPUT call.

Previously, IOSwitchboard terminated itself after io redirect had
been finished and occasionally before an http response had been sent
to the agent for `ATTACH_CONTAINER_INPUT` request. This patch ensures
that termination of the IOSwitchboard server process does not occur
before input stream is closed and an HTTP response is send to the
writer.

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


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

Branch: refs/heads/1.5.x
Commit: 30971e72d238ac6942f40a500a83f7fa31ac9c30
Parents: 8a9f99e
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Wed Jan 17 12:25:32 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Feb 5 16:52:39 2018 +0100

----------------------------------------------------------------------
 src/slave/containerizer/mesos/io/switchboard.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/30971e72/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index 89dd498..d66abe7 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -1010,6 +1010,7 @@ private:
   bool waitForConnection;
   Option<Duration> heartbeatInterval;
   bool inputConnected;
+  bool redirectFinished;
   Future<unix::Socket> accept;
   Promise<Nothing> promise;
   Promise<Nothing> startRedirect;
@@ -1130,7 +1131,8 @@ IOSwitchboardServerProcess::IOSwitchboardServerProcess(
     socket(_socket),
     waitForConnection(_waitForConnection),
     heartbeatInterval(_heartbeatInterval),
-    inputConnected(false) {}
+    inputConnected(false),
+    redirectFinished(false) {}
 
 
 Future<Nothing> IOSwitchboardServerProcess::run()
@@ -1215,7 +1217,12 @@ Future<Nothing> IOSwitchboardServerProcess::run()
 
       collect(stdoutRedirect, stderrRedirect)
         .then(defer(self(), [this]() {
-          terminate(self(), false);
+          redirectFinished = true;
+          // If IO redirect is finished, we need to give a chance
+          // to send a http response for an input connection.
+          if (!inputConnected) {
+            terminate(self(), false);
+          }
           return Nothing();
         }));
 
@@ -1661,8 +1668,9 @@ Future<http::Response> IOSwitchboardServerProcess::attachContainerInput(
 
       // We only set `failure` if writing to `stdin` failed, in which
       // case we want to terminate ourselves (after flushing any
-      // outstanding messages from our message queue).
-      if (failure.isSome()) {
+      // outstanding messages from our message queue). Also, if IO redirect
+      // is finished, we want to terminate ourselves.
+      if (failure.isSome() || redirectFinished) {
         terminate(self(), false);
       }
 


[2/6] mesos git commit: Rewrote some comments in switchboard.cpp for clarity.

Posted by al...@apache.org.
Rewrote some comments in switchboard.cpp for clarity.


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

Branch: refs/heads/1.5.x
Commit: 6fe8f575037c8a1505ac1f0d52cb000982fdda86
Parents: 30971e7
Author: Alexander Rukletsov <al...@apache.org>
Authored: Wed Jan 17 15:25:46 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Feb 5 16:53:20 2018 +0100

----------------------------------------------------------------------
 src/slave/containerizer/mesos/io/switchboard.cpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6fe8f575/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index d66abe7..18a2c47 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -1010,7 +1010,7 @@ private:
   bool waitForConnection;
   Option<Duration> heartbeatInterval;
   bool inputConnected;
-  bool redirectFinished;
+  bool redirectFinished;  // Set when both stdout and stderr redirects finish.
   Future<unix::Socket> accept;
   Promise<Nothing> promise;
   Promise<Nothing> startRedirect;
@@ -1218,8 +1218,10 @@ Future<Nothing> IOSwitchboardServerProcess::run()
       collect(stdoutRedirect, stderrRedirect)
         .then(defer(self(), [this]() {
           redirectFinished = true;
-          // If IO redirect is finished, we need to give a chance
-          // to send a http response for an input connection.
+
+          // Postpone termination if input is connected. This gives us a chance
+          // to properly close the input connection and send an http response,
+          // see `attachContainerInput()`.
           if (!inputConnected) {
             terminate(self(), false);
           }
@@ -1666,10 +1668,10 @@ Future<http::Response> IOSwitchboardServerProcess::attachContainerInput(
       // Reset `inputConnected` to allow future input connections.
       inputConnected = false;
 
-      // We only set `failure` if writing to `stdin` failed, in which
-      // case we want to terminate ourselves (after flushing any
-      // outstanding messages from our message queue). Also, if IO redirect
-      // is finished, we want to terminate ourselves.
+      // We only set `failure` if writing to `stdin` failed, in which case we
+      // want to terminate ourselves (after flushing any outstanding messages
+      // from our message queue). Also, if IO redirect has already finished,
+      // we can safely terminate.
       if (failure.isSome() || redirectFinished) {
         terminate(self(), false);
       }


[6/6] mesos git commit: Added MESOS-7742 to the 1.5.1 CHANGELOG.

Posted by al...@apache.org.
Added MESOS-7742 to the 1.5.1 CHANGELOG.


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

Branch: refs/heads/1.5.x
Commit: c336fafa7251cf0bdd1d5b98cddab0bbdd0a7985
Parents: 474411f
Author: Alexander Rukletsov <al...@apache.org>
Authored: Mon Feb 5 17:01:00 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Feb 5 17:01:00 2018 +0100

----------------------------------------------------------------------
 CHANGELOG | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c336fafa/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 0b606de..f698fd5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,11 @@
+Release Notes - Mesos - Version 1.5.1 (WIP)
+-------------------------------------------
+* This is a bug fix release.
+
+** Bug
+ * [MESOS-7742] - Race conditions in IOSwitchboard: listening on unix socket and premature closing of the connection.
+
+
 Release Notes - Mesos - Version 1.5.0
 -------------------------------------------
 This release contains the following new features:


[5/6] mesos git commit: Fixed connection refused error in IOSwitchboard for unix socket.

Posted by al...@apache.org.
Fixed connection refused error in IOSwitchboard for unix socket.

Once IOSwitchboard's unix socket appears in the file system, the agent
can try to connect to it. If the agent attempts to connect to the
socket before `listen()` has been called, then it gets connection
refused error. To address this, we initialize a unix socket using a
provisional path and rename it after `listen()` has been called.

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


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

Branch: refs/heads/1.5.x
Commit: 474411fab68ffdb87c48d7bca449ff3e41cc4c1b
Parents: f877886
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Thu Jan 25 01:19:06 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Feb 5 16:55:04 2018 +0100

----------------------------------------------------------------------
 .../containerizer/mesos/io/switchboard.cpp      | 47 +++++++++++++-------
 src/slave/containerizer/mesos/paths.cpp         | 16 +++++++
 src/slave/containerizer/mesos/paths.hpp         | 13 ++++++
 3 files changed, 61 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/474411fa/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index 6422fee..dc48a2b 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -686,10 +686,6 @@ Future<http::Connection> IOSwitchboard::_connect(
         return Failure("I/O switchboard has shutdown");
       }
 
-      // TODO(jieyu): We might still get a connection refused error
-      // here because the server might not have started listening on
-      // the socket yet. Consider retrying if 'http::connect' failed
-      // with ECONNREFUSED.
       return http::connect(address.get(), http::Scheme::HTTP);
     }));
 #endif // __WINDOWS__
@@ -828,16 +824,24 @@ Future<Nothing> IOSwitchboard::cleanup(
         // this container's `IOSwitchboardServer`. If it hasn't been
         // checkpointed yet, or the socket file itself hasn't been created,
         // we simply continue without error.
+        //
+        // NOTE: As the I/O switchboard creates a unix domain socket using
+        // a provisional address before initialiazing and renaming it, we assume
+        // that the absence of the unix socket at the original address means
+        // that the the I/O switchboard has been terminated before renaming.
         Result<unix::Address> address = getContainerIOSwitchboardAddress(
             flags.runtime_dir, containerId);
 
-        if (address.isSome()) {
-          Try<Nothing> rm = os::rm(address->path());
-          if (rm.isError()) {
-            LOG(ERROR) << "Failed to remove unix domain socket file"
-                       << " '" << address->path() << "' for container"
-                       << " '" << containerId << "': " << rm.error();
-          }
+        const string socketPath = address.isSome()
+          ? address->path()
+          : getContainerIOSwitchboardSocketProvisionalPath(
+                flags.runtime_dir, containerId);
+
+        Try<Nothing> rm = os::rm(socketPath);
+        if (rm.isError()) {
+          LOG(ERROR) << "Failed to remove unix domain socket file"
+                     << " '" << socketPath << "' for container"
+                     << " '" << containerId << "': " << rm.error();
         }
 
         return Nothing();
@@ -1034,22 +1038,35 @@ Try<Owned<IOSwitchboardServer>> IOSwitchboardServer::create(
     return Error("Failed to create socket: " + socket.error());
   }
 
-  Try<unix::Address> address = unix::Address::create(socketPath);
+  // Agent connects to the switchboard once it sees a unix socket. However,
+  // the unix socket is not ready to accept connections until `listen()` has
+  // been called. Therefore we initialize a unix socket using a provisional path
+  // and rename it after `listen()` has been called.
+  const string socketProvisionalPath =
+      getContainerIOSwitchboardSocketProvisionalPath(socketPath);
+
+  Try<unix::Address> address = unix::Address::create(socketProvisionalPath);
   if (address.isError()) {
-    return Error("Failed to build address from '" + socketPath + "':"
+    return Error("Failed to build address from '" + socketProvisionalPath + "':"
                  " " + address.error());
   }
 
   Try<unix::Address> bind = socket->bind(address.get());
   if (bind.isError()) {
-    return Error("Failed to bind to address '" + socketPath + "':"
+    return Error("Failed to bind to address '" + socketProvisionalPath + "':"
                  " " + bind.error());
   }
 
   Try<Nothing> listen = socket->listen(64);
   if (listen.isError()) {
     return Error("Failed to listen on socket at address"
-                 " '" + socketPath + "': " + listen.error());
+                 " '" + socketProvisionalPath + "': " + listen.error());
+  }
+
+  Try<Nothing> renameSocket = os::rename(socketProvisionalPath, socketPath);
+  if (renameSocket.isError()) {
+    return Error("Failed to rename socket from '" + socketProvisionalPath + "'"
+                 " to '" + socketPath + "': " + renameSocket.error());
   }
 
   return new IOSwitchboardServer(

http://git-wip-us.apache.org/repos/asf/mesos/blob/474411fa/src/slave/containerizer/mesos/paths.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/paths.cpp b/src/slave/containerizer/mesos/paths.cpp
index bb5570f..7e2779e 100644
--- a/src/slave/containerizer/mesos/paths.cpp
+++ b/src/slave/containerizer/mesos/paths.cpp
@@ -206,6 +206,22 @@ string getContainerIOSwitchboardSocketPath(
 }
 
 
+string getContainerIOSwitchboardSocketProvisionalPath(
+    const std::string& socketPath)
+{
+  return socketPath + "_provisional";
+}
+
+
+string getContainerIOSwitchboardSocketProvisionalPath(
+    const std::string& runtimeDir,
+    const ContainerID& containerId)
+{
+  return getContainerIOSwitchboardSocketProvisionalPath(
+      getContainerIOSwitchboardSocketPath(runtimeDir, containerId));
+}
+
+
 Result<unix::Address> getContainerIOSwitchboardAddress(
     const string& runtimeDir,
     const ContainerID& containerId)

http://git-wip-us.apache.org/repos/asf/mesos/blob/474411fa/src/slave/containerizer/mesos/paths.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/paths.hpp b/src/slave/containerizer/mesos/paths.hpp
index 65830a1..b9f0f45 100644
--- a/src/slave/containerizer/mesos/paths.hpp
+++ b/src/slave/containerizer/mesos/paths.hpp
@@ -144,6 +144,19 @@ std::string getContainerIOSwitchboardSocketPath(
     const ContainerID& containerId);
 
 
+// The helper method to get the io switchboard provisional socket path,
+// see comment in IOSwitchboardServer::create().
+std::string getContainerIOSwitchboardSocketProvisionalPath(
+    const std::string& socketPath);
+
+
+// The helper method to get the io switchboard provisional socket path,
+// see comment in IOSwitchboardServer::create().
+std::string getContainerIOSwitchboardSocketProvisionalPath(
+    const std::string& runtimeDir,
+    const ContainerID& containerId);
+
+
 // The helper method to read the io switchboard socket file.
 Result<process::network::unix::Address> getContainerIOSwitchboardAddress(
     const std::string& runtimeDir,


[3/6] mesos git commit: Updated comments in IOSwitchboard.

Posted by al...@apache.org.
Updated comments in IOSwitchboard.

This is addendum to review https://reviews.apache.org/r/65122

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


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

Branch: refs/heads/1.5.x
Commit: e81b5c134f63d2fa49fbdc5fca610f2492e37bbd
Parents: 6fe8f57
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Wed Jan 17 17:15:38 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Feb 5 16:54:21 2018 +0100

----------------------------------------------------------------------
 .../containerizer/mesos/io/switchboard.cpp      | 29 +++++++++++---------
 1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e81b5c13/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index 18a2c47..fb74ed6 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -1175,11 +1175,12 @@ Future<Nothing> IOSwitchboardServerProcess::run()
       // fail the future.
       //
       // For now we simply assume that whenever both `stdoutRedirect`
-      // and `stderrRedirect` have completed then it is OK to exit the
-      // switchboard process. We assume this because `stdoutRedirect`
-      // and `stderrRedirect` will only complete after both the read end
-      // of the `stdout` stream and the read end of the `stderr` stream
-      // have been drained. Since draining these `fds` represents having
+      // and `stderrRedirect` have completed while there is no input
+      // connected then it is OK to exit the switchboard process.
+      // We assume this because `stdoutRedirect` and `stderrRedirect`
+      // will only complete after both the read end of the `stdout`
+      // stream and the read end of the `stderr` stream have been
+      // drained. Since draining these `fds` represents having
       // read everything possible from a container's `stdout` and
       // `stderr` this is likely sufficient termination criteria.
       // However, there's a non-zero chance that *some* containers may
@@ -1188,6 +1189,12 @@ Future<Nothing> IOSwitchboardServerProcess::run()
       // containers with this behavior and we will exit out of the
       // switchboard process early.
       //
+      // If our IO redirects are finished and there is an input connected,
+      // then we postpone our termination until either a container closes
+      // its `stdin` or a client closes the input connection so that we can
+      // guarantee returning a http response for `ATTACH_CONTAINER_INPUT`
+      // request before terminating ourselves.
+      //
       // NOTE: We always call `terminate()` with `false` to ensure
       // that our event queue is drained before actually terminating.
       // Without this, it's possible that we might drop some data we
@@ -1219,9 +1226,6 @@ Future<Nothing> IOSwitchboardServerProcess::run()
         .then(defer(self(), [this]() {
           redirectFinished = true;
 
-          // Postpone termination if input is connected. This gives us a chance
-          // to properly close the input connection and send an http response,
-          // see `attachContainerInput()`.
           if (!inputConnected) {
             terminate(self(), false);
           }
@@ -1668,11 +1672,10 @@ Future<http::Response> IOSwitchboardServerProcess::attachContainerInput(
       // Reset `inputConnected` to allow future input connections.
       inputConnected = false;
 
-      // We only set `failure` if writing to `stdin` failed, in which case we
-      // want to terminate ourselves (after flushing any outstanding messages
-      // from our message queue). Also, if IO redirect has already finished,
-      // we can safely terminate.
-      if (failure.isSome() || redirectFinished) {
+      // If IO redirects are finished or writing to `stdin` failed we want
+      // to terminate ourselves (after flushing any outstanding messages
+      // from our message queue).
+      if (redirectFinished || failure.isSome()) {
         terminate(self(), false);
       }
 


[4/6] mesos git commit: Used a namespace for paths in IOSwitchboard.

Posted by al...@apache.org.
Used a namespace for paths in IOSwitchboard.

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


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

Branch: refs/heads/1.5.x
Commit: f877886b68c80b4cde6d70541522583a3132fbfd
Parents: e81b5c1
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Thu Jan 25 01:18:58 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Feb 5 16:55:04 2018 +0100

----------------------------------------------------------------------
 .../containerizer/mesos/io/switchboard.cpp      | 29 +++++++++-----------
 1 file changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f877886b/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index fb74ed6..6422fee 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -77,6 +77,8 @@ namespace http = process::http;
 namespace unix = process::network::unix;
 #endif // __WINDOWS__
 
+using namespace mesos::internal::slave::containerizer::paths;
+
 using std::list;
 using std::map;
 using std::string;
@@ -175,7 +177,7 @@ Future<Nothing> IOSwitchboard::recover(
   foreach (const ContainerState& state, states) {
     const ContainerID& containerId = state.container_id();
 
-    const string path = containerizer::paths::getContainerIOSwitchboardPath(
+    const string path = getContainerIOSwitchboardPath(
         flags.runtime_dir, containerId);
 
     // If we don't have a checkpoint directory created for this
@@ -186,7 +188,7 @@ Future<Nothing> IOSwitchboard::recover(
       continue;
     }
 
-    Result<pid_t> pid = containerizer::paths::getContainerIOSwitchboardPid(
+    Result<pid_t> pid = getContainerIOSwitchboardPid(
         flags.runtime_dir, containerId);
 
     // For active containers that have an io switchboard directory,
@@ -211,7 +213,7 @@ Future<Nothing> IOSwitchboard::recover(
 
   // Recover the io switchboards from any orphaned containers.
   foreach (const ContainerID& orphan, orphans) {
-    const string path = containerizer::paths::getContainerIOSwitchboardPath(
+    const string path = getContainerIOSwitchboardPath(
         flags.runtime_dir, orphan);
 
     // If we don't have a checkpoint directory created for this
@@ -220,7 +222,7 @@ Future<Nothing> IOSwitchboard::recover(
       continue;
     }
 
-    Result<pid_t> pid = containerizer::paths::getContainerIOSwitchboardPid(
+    Result<pid_t> pid = getContainerIOSwitchboardPid(
         flags.runtime_dir, orphan);
 
     // If we were able to retrieve the checkpointed pid, we simply
@@ -515,8 +517,7 @@ Future<Option<ContainerLaunchInfo>> IOSwitchboard::_prepare(
   // container. The lack of any expected files in this directroy
   // during recovery/cleanup indicates that something went wrong and
   // we need to take appropriate action.
-  string path = containerizer::paths::getContainerIOSwitchboardPath(
-      flags.runtime_dir, containerId);
+  string path = getContainerIOSwitchboardPath(flags.runtime_dir, containerId);
 
   Try<Nothing> mkdir = os::mkdir(path);
   if (mkdir.isError()) {
@@ -593,8 +594,7 @@ Future<Option<ContainerLaunchInfo>> IOSwitchboard::_prepare(
 
   // Now that the child has come up, we checkpoint the socket
   // address we told it to bind to so we can access it later.
-  path = containerizer::paths::getContainerIOSwitchboardSocketPath(
-      flags.runtime_dir, containerId);
+  path = getContainerIOSwitchboardSocketPath(flags.runtime_dir, containerId);
 
   Try<Nothing> checkpointed = slave::state::checkpoint(
       path, switchboardFlags.socket_path.get());
@@ -606,8 +606,7 @@ Future<Option<ContainerLaunchInfo>> IOSwitchboard::_prepare(
   }
 
   // We also checkpoint the child's pid.
-  path = containerizer::paths::getContainerIOSwitchboardPidPath(
-      flags.runtime_dir, containerId);
+  path = getContainerIOSwitchboardPidPath(flags.runtime_dir, containerId);
 
   checkpointed = slave::state::checkpoint(path, stringify(child->pid()));
 
@@ -662,9 +661,8 @@ Future<http::Connection> IOSwitchboard::_connect(
   // NOTE: We explicitly don't want to check for the existence of
   // `containerId` in our `infos` struct. Otherwise we wouldn't be
   // able to reconnect to the io switchboard after agent restarts.
-  Result<unix::Address> address =
-    containerizer::paths::getContainerIOSwitchboardAddress(
-        flags.runtime_dir, containerId);
+  Result<unix::Address> address = getContainerIOSwitchboardAddress(
+      flags.runtime_dir, containerId);
 
   if (!address.isSome()) {
     return Failure("Failed to get the io switchboard address"
@@ -830,9 +828,8 @@ Future<Nothing> IOSwitchboard::cleanup(
         // this container's `IOSwitchboardServer`. If it hasn't been
         // checkpointed yet, or the socket file itself hasn't been created,
         // we simply continue without error.
-        Result<unix::Address> address =
-          containerizer::paths::getContainerIOSwitchboardAddress(
-              flags.runtime_dir, containerId);
+        Result<unix::Address> address = getContainerIOSwitchboardAddress(
+            flags.runtime_dir, containerId);
 
         if (address.isSome()) {
           Try<Nothing> rm = os::rm(address->path());