[ 
https://issues.apache.org/jira/browse/MESOS-8913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475764#comment-16475764
 ] 

Benjamin Bannier commented on MESOS-8913:
-----------------------------------------

A possible patch against leveldb is listed below. Like mentioned above it would 
not address the more general issue in MESOS-8917.
{code:java}
>From d16a440b7febb437f644e144335726b6d3d95c29 Mon Sep 17 00:00:00 2001
From: Benjamin Bannier <[email protected]>
Date: Tue, 15 May 2018 14:12:31 +0200
Subject: [PATCH 2/2] Use O_CLOEXEC when opening files.

---
util/env_posix.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/env_posix.cc b/util/env_posix.cc
index a17dec2..bbfbd90 100644
--- a/util/env_posix.cc
+++ b/util/env_posix.cc
@@ -226,7 +226,7 @@ class PosixWritableFile : public WritableFile {
}
Status s;
if (basename.starts_with("MANIFEST")) {
- int fd = open(dir.c_str(), O_RDONLY);
+ int fd = open(dir.c_str(), O_RDONLY | O_CLOEXEC);
if (fd < 0) {
s = IOError(dir, errno);
} else {
@@ -313,7 +313,7 @@ class PosixEnv : public Env {
RandomAccessFile** result) {
*result = NULL;
Status s;
- int fd = open(fname.c_str(), O_RDONLY);
+ int fd = open(fname.c_str(), O_RDONLY | O_CLOEXEC);
if (fd < 0) {
s = IOError(fname, errno);
} else if (mmap_limit_.Acquire()) {
@@ -429,7 +429,7 @@ class PosixEnv : public Env {
virtual Status LockFile(const std::string& fname, FileLock** lock) {
*lock = NULL;
Status result;
- int fd = open(fname.c_str(), O_RDWR | O_CREAT, 0644);
+ int fd = open(fname.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0644);
if (fd < 0) {
result = IOError(fname, errno);
} else if (!locks_.Insert(fname)) {
-- 
2.9.5

{code}

> Resource provider manager registry leaks file descriptors into executors.
> -------------------------------------------------------------------------
>
>                 Key: MESOS-8913
>                 URL: https://issues.apache.org/jira/browse/MESOS-8913
>             Project: Mesos
>          Issue Type: Bug
>          Components: agent, security, storage
>    Affects Versions: 1.6.0
>            Reporter: James Peach
>            Assignee: Benjamin Bannier
>            Priority: Major
>
> I have an executor that closes unknown file descriptors when it starts up:
> {noformat}
> 2018/05/14 20:54:43.210293 util_linux.go:65: closing extraneous fd 126 
> (/srv/mesos/work/meta/slaves/30d57187-99b4-4e63-aba8-f425a80a6702-S8/resource_provider_registry/000008.log)
> 2018/05/14 20:54:43.210345 util_linux.go:47: unable to call fcntl() to get fd 
> options for fd 3: errno bad file descriptor
> 2018/05/14 20:54:43.210385 util_linux.go:65: closing extraneous fd 321 
> (/srv/mesos/work/meta/slaves/30d57187-99b4-4e63-aba8-f425a80a6702-S8/resource_provider_registry/LOG)
> 2018/05/14 20:54:43.210438 util_linux.go:65: closing extraneous fd 322 
> (/srv/mesos/work/meta/slaves/30d57187-99b4-4e63-aba8-f425a80a6702-S8/resource_provider_registry/LOCK)
> 2018/05/14 20:54:43.210501 util_linux.go:65: closing extraneous fd 324 
> (/srv/mesos/work/meta/slaves/30d57187-99b4-4e63-aba8-f425a80a6702-S8/resource_provider_registry/MANIFEST-000006)
> {noformat}
> It is closing leveldb descriptors leaked by the resource provider manager 
> registry in the agent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to