You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Dmitry Zhuk (JIRA)" <ji...@apache.org> on 2017/01/27 16:02:24 UTC
[jira] [Created] (MESOS-7020) cgroups::internal::write can
incorrectly report success
Dmitry Zhuk created MESOS-7020:
----------------------------------
Summary: 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
Priority: Minor
{{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.4#6332)