You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Adam B (JIRA)" <ji...@apache.org> on 2017/02/10 07:21:41 UTC

[jira] [Updated] (MESOS-7020) cgroups::internal::write can incorrectly report success

     [ https://issues.apache.org/jira/browse/MESOS-7020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam B updated MESOS-7020:
--------------------------
    Fix Version/s:     (was: 1.3.0)
                   1.2.0

> cgroups::internal::write can incorrectly report success
> -------------------------------------------------------
>
>                 Key: MESOS-7020
>                 URL: https://issues.apache.org/jira/browse/MESOS-7020
>             Project: Mesos
>          Issue Type: Bug
>          Components: cgroups
>    Affects Versions: 1.2.0
>         Environment: CentOS7
>            Reporter: Dmitry Zhuk
>            Assignee: Jie Yu
>            Priority: Minor
>             Fix For: 1.2.0
>
>
> {{cgroups::internal::write}} does not flush stream before checking for errors after writing:
> {code}
>   ofstream file(path.c_str());
> ...
>   file << value;
>   if (file.fail()) {
>     // TODO(jieyu): Does ofstream actually set errno?
>     return ErrnoError();
>   }
> {code}
> Since {{ofstream}} does internal buffering, {{file.fail()}} can return {{false}}, as value hasn't been written to file yet.
> Replacing {{file << value;}} with {{file << value << std::flush;}} makes {{file.fail()}} behave as expected.



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