[
https://issues.apache.org/jira/browse/HADOOP-20067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated HADOOP-20067:
------------------------------------
Labels: pull-request-available (was: )
> RawLocalFileSystem: broken double-checked locking in
> LocalFSFileInputStream#getAsyncChannel() can leak AsynchronousFileChannels
> -------------------------------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-20067
> URL: https://issues.apache.org/jira/browse/HADOOP-20067
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Reporter: Yang Jie
> Priority: Minor
> Labels: pull-request-available
>
> LocalFSFileInputStream#getAsyncChannel() checks {{asyncChannel == null}}
> outside the lock but not again inside it, and the field is not volatile. When
> two threads make the first readVectored() call on the same stream, both can
> open an AsynchronousFileChannel. The last assignment wins and close() only
> closes that channel, so the other one keeps its file descriptor open until
> the JVM exits. PositionedReadable requires positioned reads, readVectored
> included, to be thread-safe.
> The fix makes the field volatile and checks it again inside the synchronized
> block. This was pointed out in the review of HADOOP-19901:
> https://github.com/apache/hadoop/pull/8511#discussion_r4452981403. A
> readVectored() call after close() still opens a new channel; this change does
> not touch that.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]