lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] Commented: (LUCENE-1431) NullPointerException in CloseableThreadLocal#get() if CTL is closed
Date Thu, 30 Oct 2008 10:29:44 GMT


Michael McCandless commented on LUCENE-1431:

OK, so you were continuing to use a TermDocs after its reader had been closed.

Unfortunately, Lucene doesn't and can't really guarantee you'll always get a nice AlreadyClosedException
in all possible places where you use a reader after closing it, because inserting that check
could be a performance hit.

So what happens (NPE or IOE etc.) is intentionally not defined/guaranteed, though we will
in general make a "best effort" to throw an AlreadyClosedException when possible.

In this particular case I don't see an obvious place to insert an ensureOpen() call without
risking a performance hit.

incRef/decRef should solve this nicely.

> NullPointerException in CloseableThreadLocal#get() if CTL is closed
> -------------------------------------------------------------------
>                 Key: LUCENE-1431
>                 URL:
>             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 Source)
>      at org.apache.lucene.index.MultiSegmentReader$MultiTermDocs.termDocs(Unknown Source)
>      at org.apache.lucene.index.MultiSegmentReader$ 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:
For additional commands, e-mail:

View raw message