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

Joseph Wu commented on MESOS-5882:
----------------------------------

We use {{cloexec}} to change how subprocesses inherit file descriptors 
(inherited by default on Posix, which we need to change in order to not leak 
FDs).  In contrast, FDs are *not* inherited by default on Windows, so we've 
left {{cloexec}} as a no-op on Windows.

At the moment, this is fine.  However, the introduction of the IO Switchboard 
(for exec-ing into containers) added a case where we explicitly want to inherit 
FDs.  This is done with a ChildHook that unsets the {{O_CLOEXEC}} option on a 
specific FD before creating a subprocess:
https://github.com/apache/mesos/blob/1.2.x/3rdparty/libprocess/include/process/subprocess_base.hpp#L212-L216
https://github.com/apache/mesos/blob/1.2.x/src/slave/containerizer/mesos/io/switchboard.cpp#L563-L565

This feature isn't supported in Windows, but we might want to support it at 
some point in the future.  That means we need to provide a way of selectively 
inheriting FDs on Windows.

> `os::cloexec` does not exist on Windows
> ---------------------------------------
>
>                 Key: MESOS-5882
>                 URL: https://issues.apache.org/jira/browse/MESOS-5882
>             Project: Mesos
>          Issue Type: Bug
>          Components: stout
>            Reporter: Alex Clemmer
>            Assignee: Joseph Wu
>              Labels: mesosphere, stout
>
> `os::cloexec` does not work on Windows. It will never work at the OS level. 
> Because of this, there are likely many important and hard-to-detect bugs 
> hanging around the agent.
> This is extremely important to fix. Some possible solutions to investigate 
> (some of which are _extremely_ risky):
> * Abstract out file descriptors into a class, implement cloexec in that class 
> on Windows (since we can't rely on the OS to do it).
> * Refactor all the code that relies on `os::cloexec` to not rely on it.
> Of the two, the first seems less risky in the short term, because the cloexec 
> code only affects Windows. Depending on the semantics of the implementation 
> of the `FileDescriptor` class, it is possible that this is riskier to Windows 
> in the longer term, as the semantics of `cloexec` may have subtle difference 
> between Linux and Windows.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to