[ https://issues.apache.org/jira/browse/MESOS-7020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jie Yu reassigned MESOS-7020: ----------------------------- Assignee: Jie Yu > 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.3.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)