zhouyingchao created HDFS-10182: ----------------------------------- Summary: Hedged read might overwrite user's buf Key: HDFS-10182 URL: https://issues.apache.org/jira/browse/HDFS-10182 Project: Hadoop HDFS Issue Type: Bug Reporter: zhouyingchao Assignee: zhouyingchao
In DFSInputStream::hedgedFetchBlockByteRange, the passed-in buf from the caller is passed to another thread to fill in the first attempt. If the first attempt is timed out, the second attempt would be issued with another 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. -- This message was sent by Atlassian JIRA (v6.3.4#6332)