Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 38452 invoked from network); 30 Oct 2008 10:12:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2008 10:12:38 -0000 Received: (qmail 5901 invoked by uid 500); 30 Oct 2008 10:12:41 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 5830 invoked by uid 500); 30 Oct 2008 10:12:40 -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 5821 invoked by uid 99); 30 Oct 2008 10:12:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Oct 2008 03:12:40 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Oct 2008 10:11:34 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 46AFE234C24A for ; Thu, 30 Oct 2008 03:11:44 -0700 (PDT) Message-ID: <1464855028.1225361504288.JavaMail.jira@brutus> Date: Thu, 30 Oct 2008 03:11:44 -0700 (PDT) From: "Andreas Kohn (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-1431) NullPointerException in CloseableThreadLocal#get() if CTL is closed In-Reply-To: <2102756153.1225358144169.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-1431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643796#action_12643796 ] Andreas Kohn commented on LUCENE-1431: -------------------------------------- Continueing reading application and lucene code, the patch will only move the NPE to a few lines later when TermInfosReaders#getThreadResources() tries to call CloseableThreadLocal#set() with the newly created resources. A bit more context on the application where I hit this problem: This is a web application that runs a periodic update check that will create new readers on a newer indices (no reopen, real creation of the readers), and close the older ones. Requests will get the currently open reader, and generally handle the case where this gets closed by catching the exceptions and doing "something sensible". The exception is hit in a place that is implementing a Filter, and expects an IOException if the reader is closed by chance. With lucene 2.3.2, this worked nicely, but with 2.4.0 we get the above exception, instead of the expected IOException. I see that there is now IndexReader#incRef() and IndexReader#decRef(), so I'll play with those methods to prevent "early" closing of readers, and avoid handling the exceptions. The question still remains whether CloseableThreadLocal should somehow handle the 'closed' state in get()/set(), or whether documentation should be added that close() really means nothing else will work after that. > NullPointerException in CloseableThreadLocal#get() if CTL is closed > ------------------------------------------------------------------- > > Key: LUCENE-1431 > URL: https://issues.apache.org/jira/browse/LUCENE-1431 > Project: Lucene - Java > Issue Type: Bug > Components: Other > Affects Versions: 2.4 > Environment: Linux Fedora 9, amd64, Sun JDK 1.6.0_03 amd64 > Reporter: Andreas Kohn > Attachments: LUCENE-1431.diff > > > Pretty simple NPE, happening because some thread closed the CloseableThreadLocal, but another place still wanted to look at it: > {noformat} > java.lang.NullPointerException > at org.apache.lucene.util.CloseableThreadLocal.get(Unknown Source) > at org.apache.lucene.index.TermInfosReader.getThreadResources(Unknown Source) > at org.apache.lucene.index.TermInfosReader.get(Unknown Source) > at org.apache.lucene.index.TermInfosReader.get(Unknown Source) > at org.apache.lucene.index.SegmentTermDocs.seek(Unknown Source) > at org.apache.lucene.index.MultiSegmentReader$MultiTermDocs.termDocs(Unknown Source) > at org.apache.lucene.index.MultiSegmentReader$MultiTermDocs.next(Unknown Source) > {noformat} > I believe the attached patch should fix those. -- 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