You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Chris Nauroth (JIRA)" <ji...@apache.org> on 2013/09/15 18:10:52 UTC

[jira] [Commented] (HDFS-5211) Race condition between DistributedFileSystem#close and FileSystem#close can cause return of a closed DistributedFileSystem instance from the FileSystem cache.

    [ https://issues.apache.org/jira/browse/HDFS-5211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13767826#comment-13767826 ] 

Chris Nauroth commented on HDFS-5211:
-------------------------------------

This is only a problem on branch-1.  The branch-1 code closes {{DFSClient}} before removing from the cache:

{code}
  public void close() throws IOException {
    try {
      super.processDeleteOnExit();
      dfs.close();
    } finally {
      super.close();
    }
  }
{code}

It's not a problem on trunk, because the trunk version removes from the cache before closing the {{DFSClient}}:

{code}
  @Override
  public void close() throws IOException {
    try {
      dfs.closeOutputStreams(false);
      super.close();
    } finally {
      dfs.close();
    }
  }
{code}

                
> Race condition between DistributedFileSystem#close and FileSystem#close can cause return of a closed DistributedFileSystem instance from the FileSystem cache.
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-5211
>                 URL: https://issues.apache.org/jira/browse/HDFS-5211
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 1.2.1
>            Reporter: Chris Nauroth
>
> {{DistributedFileSystem#close}} closes the underlying {{DFSClient}} before the superclass call to {{FileSystem#close}}, which removes the instance from the cache.  This leaves a small window during which another thread can call {{FileSystem#get}} and receive the closed instance from the cache.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira