lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3567) NPE from SegmentTermDocs.<init> from SegmentReader.termDocs
Date Mon, 07 Nov 2011 18:12:51 GMT


Michael McCandless commented on LUCENE-3567:

Hmm try to double check all places that close/decRef the reader; most likely the IR is over-decRef'd,

Are there threads involved?  If so, it could be one thread closes the IR while another thread
is still using it (which could explain why SR.termDocs call to ensureOpen didn't catch that
the reader was closed, ie the close happened in the tiny window after ensureOpen and before
STD.init called .getTermsReader()).

Lucene 3.5.0 will have the SearcherManager class to handle correctly sharing a searcher across
threads with reopens... probably back-porting to work on 3.0.x wouldn't be so bad?  I described
it here:
> NPE from SegmentTermDocs.<init> from SegmentReader.termDocs
> -----------------------------------------------------------
>                 Key: LUCENE-3567
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.0.3
>         Environment: various OS and JRE combos:
>            Reporter: Jesse Glick
> Occasionally NetBeans IDE users receive an NPE from Lucene 3.0.3 inside Maven Indexer
(currently 4.1.2) code:
> {code}
> java.lang.NullPointerException
> 	at org.apache.lucene.index.SegmentTermDocs.<init>(
> 	at org.apache.lucene.index.SegmentReader.termDocs(
> 	at org.apache.lucene.index.IndexReader.termDocs(
> 	at org.apache.lucene.index.SegmentReader.termDocs(
> 	at$TermWeight.scorer(
> 	at
> 	at
> 	at
> 	at
> 	at org.apache.maven.index.DefaultIndexerEngine.getOldDocument(
>         ....
> {code}
> Working backwards, {{parent.core.getTermsReader()}} is null, which means {{SegmentReaders.CoreReaders.decRef}}
was called, which means {{SegmentReader.doClose}} was called, which means {{IndexReader.doClose}}
was called, which I suppose means something called {{IndexReader.decRef}} prematurely. But
plenty of things can call {{IndexReader.decRef}} and it is not clear how to track down the
root cause.
> Note that {{SegmentReader.termDocs}} first calls {{ensureOpen()}}, which is presumably
supposed to ensure that {{decRef}} had not been called too many times; perhaps this assertion
did not work?
> Downstream bug, for reference:

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message