Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10182

Hedged read might overwrite user's buf

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0, 2.7.3, 2.6.5, 3.0.0-alpha1
    • None
    • None
    • Reviewed

    Description

      In DFSInputStream::hedgedFetchBlockByteRange, during the first attempt, the passed-in buf from the caller is passed to another thread to fill. If the first attempt is timed out, the second attempt would be issued with another temp ByteBuffer. Now suppose the second attempt wins and the first attempt is blocked somewhere in the IO path. The second attempt's result would be copied to the buf provided by the caller and then caller would think the pread is all set. Later the caller might use the buf to do something else (for e.g. read another chunk of data), however, the first attempt in earlier hedgedFetchBlockByteRange might get some data and fill into the buf ...
      If this happens, the caller's buf would then be corrupted.

      To fix the issue, we should allocate a temp buf for the first attempt too.

      Attachments

        1. HDFS-10182-branch26.patch
          2 kB
          zhouyingchao
        2. HDFS-10182-001.patch
          2 kB
          zhouyingchao

        Activity

          People

            sinago zhouyingchao
            sinago zhouyingchao
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: