You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/06/04 20:36:47 UTC
mesos git commit: Fixed socket creation bug in `docker.cpp`.
Repository: mesos
Updated Branches:
refs/heads/master 52660fe6a -> 6ed9882a1
Fixed socket creation bug in `docker.cpp`.
On Windows, the statement `int_fd socket = ::socket(...);` would
implictly call the `WindowsFD(int crt)` constructor. Since that
contstructor only accepts values of {0, 1, 2}, it would incorrectly
mark the socket as invalid. The code has been changed to use the stout
network functions, which properly construct the `int_fd`.
On other platforms, this change is merely a refactor to use stout
wrappers.
Review: https://reviews.apache.org/r/67395/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6ed9882a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6ed9882a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6ed9882a
Branch: refs/heads/master
Commit: 6ed9882a14368bdd42619699fecec03953d22e9b
Parents: 52660fe
Author: Akash Gupta <ak...@hotmail.com>
Authored: Mon Jun 4 10:56:30 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Mon Jun 4 12:01:47 2018 -0700
----------------------------------------------------------------------
src/slave/containerizer/docker.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/6ed9882a/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 36ec3ec..391700f 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -1038,15 +1038,15 @@ Future<Nothing> DockerContainerizerProcess::_recover(
pid_t pid = run->forkedPid.get();
// Create a TCP socket.
- int_fd socket = ::socket(AF_INET, SOCK_STREAM, 0);
- if (socket < 0) {
+ Try<int_fd> socket = net::socket(AF_INET, SOCK_STREAM, 0);
+ if (socket.isError()) {
return Failure(
"Failed to create socket for connecting to executor '" +
- stringify(executor.id) + "': " + os::strerror(errno));
+ stringify(executor.id) + "': " + socket.error());
}
Try<Nothing, SocketError> connect = process::network::connect(
- socket,
+ socket.get(),
run->libprocessPid->address);
if (connect.isSome()) {
@@ -1060,8 +1060,8 @@ Future<Nothing> DockerContainerizerProcess::_recover(
}
// Shutdown and close the socket.
- shutdown(socket, SHUT_RDWR);
- close(socket);
+ ::shutdown(socket.get(), SHUT_RDWR);
+ os::close(socket.get());
container->status.future()
->onAny(defer(self(), &Self::reaped, containerId));