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

cgroups::internal::write can incorrectly report success

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.2.0
    • Component/s: containerization
    • Labels:
      None
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved: