Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-7020

cgroups::internal::write can incorrectly report success

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.0
    • 1.2.0
    • containerization
    • None
    • CentOS7

    Description

      cgroups::internal::write does not flush stream before checking for errors after writing:

        ofstream file(path.c_str());
      ...
        file << value;
      
        if (file.fail()) {
          // TODO(jieyu): Does ofstream actually set errno?
          return ErrnoError();
        }
      

      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.

      Attachments

        Activity

          People

            jieyu Jie Yu
            dzhuk Dmitry Zhuk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: