Return-Path: X-Original-To: apmail-accumulo-dev-archive@www.apache.org Delivered-To: apmail-accumulo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 960B6C27E for ; Wed, 16 May 2012 19:25:28 +0000 (UTC) Received: (qmail 91422 invoked by uid 500); 16 May 2012 19:25:28 -0000 Delivered-To: apmail-accumulo-dev-archive@accumulo.apache.org Received: (qmail 91328 invoked by uid 500); 16 May 2012 19:25:28 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 91320 invoked by uid 99); 16 May 2012 19:25:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 May 2012 19:25:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 May 2012 19:25:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3D3E28D11 for ; Wed, 16 May 2012 19:25:07 +0000 (UTC) Date: Wed, 16 May 2012 19:25:07 +0000 (UTC) From: "Keith Turner (JIRA)" To: dev@accumulo.apache.org Message-ID: <393886133.5483.1337196307252.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <959218156.52564.1336696069288.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (ACCUMULO-587) Add finalize to TabletServerBatchReader to catch when user forgets to close MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/ACCUMULO-587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13277036#comment-13277036 ] Keith Turner commented on ACCUMULO-587: --------------------------------------- It would be interesting to verify this with a test. Derefernce the batch scanner and call System.gc() a few times and see if the log message is emitted. It would be nice to have the finalize message with a logs message if it works. As for people relying on it, the finalize() method will be in impl not part of the public API. So you have to go digging around to find it. Could add some javadoc warning against relying on it. > Add finalize to TabletServerBatchReader to catch when user forgets to close > --------------------------------------------------------------------------- > > Key: ACCUMULO-587 > URL: https://issues.apache.org/jira/browse/ACCUMULO-587 > Project: Accumulo > Issue Type: Improvement > Components: client > Reporter: Dennis Patrone > Assignee: Billie Rinaldi > Priority: Trivial > > If a client forgets to close a BatchScanner or BatchDeleter, threads are leaked in the TabletServerBatchReader implementation. It would be nice if a finalize method were added to check and warn the user of such a problem. The thread pool appeared to only be shared with the TabletServerBatchReaderIterator, which maintains a reference to the TabletServerBatchReader itself. So AFAICT if the TabletServerBatchReader is eligible for garbage collection, there can be no client references to that scanner or any iterators it created (i.e., it _should_ have been closed). > For example: > {code} > protected void finalize() { > if (!queryThreadPool.isShutdown()) { > // add a logger reference in class initialization > log.warn("TabletServerBatchReader not shutdown; did you forget to call close()?"); > close(); > } > } > {code} > The same might be true for the TabletServerBatchWriter (it has a close), but I didn't look into that class. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira