Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 61941 invoked from network); 4 Mar 2007 15:52:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Mar 2007 15:52:13 -0000 Received: (qmail 58227 invoked by uid 500); 4 Mar 2007 15:52:20 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 58177 invoked by uid 500); 4 Mar 2007 15:52:20 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 58166 invoked by uid 99); 4 Mar 2007 15:52:20 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Mar 2007 07:52:20 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Mar 2007 07:52:11 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C94F0714336 for ; Sun, 4 Mar 2007 07:51:50 -0800 (PST) Message-ID: <25239749.1173023510822.JavaMail.jira@brutus> Date: Sun, 4 Mar 2007 07:51:50 -0800 (PST) From: "Yonik Seeley (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-823) Lucene fails to close file handles under certain situations In-Reply-To: <8654810.1172999810698.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477791 ] Yonik Seeley commented on LUCENE-823: ------------------------------------- > TermInfosReader.close() was setting its ThreadLocal enumerators to > null without first closing the SegmentTermEnum in there. Are you sure descriptors are really leaked in this case? There are other cases where Lucene doesn't close IndexInput clones... see LUCENE-686 The SegmentTermEnum constructor is only called in two places: - to init TermInfosReader.origEnum - to init TermInfosReader.indexEnum We can therefore conclude that all other SegmentTermEnum instances are clones, and hence close is a no-op. > Lucene fails to close file handles under certain situations > ----------------------------------------------------------- > > Key: LUCENE-823 > URL: https://issues.apache.org/jira/browse/LUCENE-823 > Project: Lucene - Java > Issue Type: Bug > Components: Index > Affects Versions: 2.1 > Reporter: Michael McCandless > Assigned To: Michael McCandless > Priority: Minor > Fix For: 2.2 > > Attachments: LUCENE-823.patch > > > As a followon to LUCENE-820, I've added a further check in > MockRAMDirectory to assert that there are no open files when the > directory is closed. > That check caused a few unit tests to fail, and in digging into the > reason I uncovered these cases where Lucene fails to close file > handles: > * TermInfosReader.close() was setting its ThreadLocal enumerators to > null without first closing the SegmentTermEnum in there. It looks > like this was part of the fix for LUCENE-436. I just added the > call to close. > This is somewhat severe since we could leak many file handles for > use cases that burn through threads and/or indexes. Though, > FSIndexInput does have a finalize() to close itself. > * Flushing of deletes in IndexWriter opens SegmentReader to do the > flushing, and it correctly calls close() to close the reader. But > if an exception is hit during commit and before actually closing, > it will leave open those handles. I fixed this first calling > doCommit() and then doClose() in a finally. The "disk full" tests > we now have were hitting this. > * IndexWriter's addIndexes(IndexReader[]) method was opening a > reader but not closing it with a try/finally. I just put a > try/finally in. > I've also changed some unit tests to use MockRAMDirectory instead of > RAMDirectory to increase testing coverage of "leaking open file > handles". -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org