Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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.