Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F7DADFA7 for ; Wed, 15 May 2013 19:31:17 +0000 (UTC) Received: (qmail 16210 invoked by uid 500); 15 May 2013 19:31:16 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 16177 invoked by uid 500); 15 May 2013 19:31:16 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 16056 invoked by uid 99); 15 May 2013 19:31:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 May 2013 19:31:16 +0000 Date: Wed, 15 May 2013 19:31:16 +0000 (UTC) From: "Colin Patrick McCabe (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-4824) FileInputStreamCache.close leaves dangling reference to FileInputStreamCache.cacheCleaner MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-4824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13658692#comment-13658692 ] Colin Patrick McCabe commented on HDFS-4824: -------------------------------------------- OK, I figured out what is going on here. scheduleAtFixedRate is actually creating a new Runnable which wraps the one that it's passed in (cacheCleaner). So telling the executor to remove cacheCleaner itself doesn't work, since the real runnable that was scheduled is the wrapper. Instead, we should keep around the future which {{scheduleAtFixedRate}} returned, and call {{Future#Cancel}} on it. Patch is attached. > 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 > > {{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