You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gi...@apache.org on 2018/08/21 23:41:54 UTC
[mesos] branch master updated: Fixed the lib_logrotate
inappropriate UNSET_CLOEXEC via ChildHook.
This is an automated email from the ASF dual-hosted git repository.
gilbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new b9d19cd Fixed the lib_logrotate inappropriate UNSET_CLOEXEC via ChildHook.
b9d19cd is described below
commit b9d19cd4e03f70014063341c64f96b5860db8b0f
Author: Gilbert Song <so...@gmail.com>
AuthorDate: Tue Aug 21 14:35:01 2018 -0700
Fixed the lib_logrotate inappropriate UNSET_CLOEXEC via ChildHook.
Previously, we call os::unsetCloexec() on write fd for both outfds and
errfds. Basically, this is not needed because all stdout and stderr
fds will be closed at childMain() method. As a result, no need to do
unsetCloexec() either from the parent process side or UNSET_CLOEXEC
via the ChildHook.
Review: https://reviews.apache.org/r/68458
---
src/slave/container_loggers/lib_logrotate.cpp | 24 ++----------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/src/slave/container_loggers/lib_logrotate.cpp b/src/slave/container_loggers/lib_logrotate.cpp
index 6a2839e..3ecd83e 100644
--- a/src/slave/container_loggers/lib_logrotate.cpp
+++ b/src/slave/container_loggers/lib_logrotate.cpp
@@ -161,8 +161,6 @@ public:
outfds.read = pipefd->at(0);
outfds.write = pipefd->at(1);
- const std::vector<int_fd> whitelistOutFds{pipefd->at(0), pipefd->at(1)};
-
// Spawn a process to handle stdout.
mesos::internal::logger::rotate::Flags outFlags;
outFlags.max_size = overriddenFlags.max_stdout_size;
@@ -184,12 +182,6 @@ public:
}
#endif // __linux__
- // TODO(gilbert): libprocess should take care of this, see MESOS-9164.
- std::vector<Subprocess::ChildHook> childHooks;
- foreach (int_fd fd, whitelistOutFds) {
- childHooks.push_back(Subprocess::ChildHook::UNSET_CLOEXEC(fd));
- }
-
Try<Subprocess> outProcess = subprocess(
path::join(flags.launcher_dir, mesos::internal::logger::rotate::NAME),
{mesos::internal::logger::rotate::NAME},
@@ -199,9 +191,7 @@ public:
&outFlags,
environment,
None(),
- parentHooks,
- childHooks,
- whitelistOutFds);
+ parentHooks);
if (outProcess.isError()) {
os::close(outfds.write.get());
@@ -221,8 +211,6 @@ public:
errfds.read = pipefd->at(0);
errfds.write = pipefd->at(1);
- const std::vector<int_fd> whitelistErrFds{pipefd->at(0), pipefd->at(1)};
-
// Spawn a process to handle stderr.
mesos::internal::logger::rotate::Flags errFlags;
errFlags.max_size = overriddenFlags.max_stderr_size;
@@ -233,12 +221,6 @@ public:
? Option<string>(containerConfig.user())
: Option<string>::none();
- // TODO(gilbert): libprocess should take care of this, see MESOS-9164.
- childHooks.clear();
- foreach (int_fd fd, whitelistErrFds) {
- childHooks.push_back(Subprocess::ChildHook::UNSET_CLOEXEC(fd));
- }
-
Try<Subprocess> errProcess = subprocess(
path::join(flags.launcher_dir, mesos::internal::logger::rotate::NAME),
{mesos::internal::logger::rotate::NAME},
@@ -248,9 +230,7 @@ public:
&errFlags,
environment,
None(),
- parentHooks,
- childHooks,
- whitelistErrFds);
+ parentHooks);
if (errProcess.isError()) {
os::close(outfds.write.get());