[
https://issues.apache.org/jira/browse/HADOOP-12707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15098366#comment-15098366
]
Chris Nauroth commented on HADOOP-12707:
----------------------------------------
bq. For the current design, even if the same user ,if the user calls this
method twice then the filesystem ojbect will be created twice.
Just a small clarification: it happens only if those 2 calls use different
{{UserGroupInformation}} instances that really represent the same "logical"
underlying user ({{Subject}}). This is a much less common usage pattern
compared to usage of a single {{UserGroupInformation}} instance that always
represents that "logical" user.
There are no plans to change this behavior at this time. The standard solution
is to do one of the two things I described in my last comment: disable the
cache in configuration or use {{FileSystem#closeAllForUGI}}.
There is a lot of legacy behind the current behavior of the {{FileSystem}}
cache. Some of it is described in HADOOP-6670, and some of it is described in
other old JIRAs. I wish we could make some big changes there, but a lot of
applications are coded to expect the current behavior.
> key of FileSystem inner class Cache contains UGI.hascode which uses the
> defualt hascode method, leading to the memory leak
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: HADOOP-12707
> URL: https://issues.apache.org/jira/browse/HADOOP-12707
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Affects Versions: 2.7.1
> Reporter: sunhaitao
> Assignee: sunhaitao
>
> FileSystem.get(conf) method,By default it will get the fs object from
> CACHE,But the key of the CACHE constains ugi.hashCode, which uses the
> default hascode method of subject instead of the hascode method overwritten
> by subject.
> @Override
> public int hashCode() {
> return (scheme + authority).hashCode() + ugi.hashCode() + (int)unique;
> }
> In this case, even if same user, if the calll FileSystem.get(conf) twice, two
> different key will be created. In long duartion, this will lead to memory
> leak.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)