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

Colin Patrick McCabe commented on HDFS-4824:
--------------------------------------------

That's an interesting idea, but we already hold strong (regular) references to 
stuff like the {{DFSClient}} and the {{PeerCache}} from the {{DFSInputStream}}. 
 So if we were going to do something like this, it should be done consistently.

Whether or not it's a good idea to start using weak references for this stuff, 
I'm a little unsure.  At some point, the code gets a lot more complex, to 
support a use case we're not supposed to be supporting.  I mean if we had to go 
through the weak reference dance each time we accessed dfsclient from 
dfsinputstream, it might be more than I could stand.  At least that's my 
initial thought.
                
> FileInputStreamCache.close leaves dangling reference to 
> FileInputStreamCache.cacheCleaner
> -----------------------------------------------------------------------------------------
>
>                 Key: HDFS-4824
>                 URL: https://issues.apache.org/jira/browse/HDFS-4824
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.0.4-alpha
>            Reporter: Henry Robinson
>            Assignee: Colin Patrick McCabe
>         Attachments: HDFS-4824.001.patch
>
>
> {{FileInputStreamCache}} leaves around a reference to its {{cacheCleaner}} 
> after {{close()}}.
> The {{cacheCleaner}} is created like this:
> {code}
> if (cacheCleaner == null) {
>           cacheCleaner = new CacheCleaner();
>           executor.scheduleAtFixedRate(cacheCleaner, expiryTimeMs, 
> expiryTimeMs,
>               TimeUnit.MILLISECONDS);
>         }
> {code}
> and supposedly removed like this:
> {code}
> if (cacheCleaner != null) {
>   executor.remove(cacheCleaner);
> }
> {code}
> However, {{ScheduledThreadPoolExecutor.remove}} returns a success boolean 
> which should be checked. And I _think_ from a quick read of that class that 
> the return value of {{scheduleAtFixedRate}} should be used as the argument to 
> {{remove}}. 

--
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

Reply via email to