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

Andrew Schwartzmeyer commented on MESOS-8673:
---------------------------------------------

Actually, we may not want to open all files in overlapping mode. On Linux, 
while {{O_NONBLOCK}} and {{os::nonblock}} are used on files, it doesn't 
actually do anything for non socket/pipe descriptors. If Linux considers the fd 
to point to a "fast" device (like a hard disk), it does everything 
synchronously anyway. Furthermore, because you can't change overlapping mode on 
an open file handle on Windows, we have to be very careful about the modes of 
handles we send to child processes.

A better approach may be to open only the read end of the named pipes in 
overlapped mode. To track which handles are overlapped or not (since there is 
no way to ask Windows this), we could add a boolean to the file part of 
{{WindowsFD}}. Because stout and libprocess were written in a POSIX way of 
thinking, we would still need {{read}} and {{write}} to deal with both 
overlapped and non-overlapped files, but this can be hidden inside the Windows 
implementations.

[~akagup] is checking how we can support redirecting the output of an arbitrary 
child process in a way where we can read it asynchronously.

> Fix os::open to use CreateFile in overlapped mode
> -------------------------------------------------
>
>                 Key: MESOS-8673
>                 URL: https://issues.apache.org/jira/browse/MESOS-8673
>             Project: Mesos
>          Issue Type: Task
>            Reporter: Andrew Schwartzmeyer
>            Assignee: Andrew Schwartzmeyer
>            Priority: Major
>              Labels: stout, windows
>
> Because we need to keep the existing API of {{os::open}} (which is POSIX-y 
> and currently uses the CRT {{_open}} on Windows), we'll need to map all the 
> possible values for {{int oflag, mode_t mode}} to equivalent semantics in 
> {{CreateFile}}.
> Our intent is to open all files in overlapped mode by default; which can be 
> read synchronously when needed (but the other way around is not possible). 
> However, it may be that we'll need to use {{ReOpenFile}} to when sending file 
> handles to child processes.



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

Reply via email to