lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Glick (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3567) NPE from SegmentTermDocs.<init> from SegmentReader.termDocs
Date Tue, 15 Nov 2011 17:38:51 GMT


Jesse Glick commented on LUCENE-3567:

Various application threads could call Maven Indexer methods but they should in all cases
be using an exclusive lock to prevent race conditions. I do not believe Maven Indexer itself
would be accessing Lucene from multiple threads. In other words, the application is not _intentionally_
using multithreaded index access. It is possible that it is doing so accidentally. Unfortunately
the low-level {{NullPointerException}} produced deep in the Lucene stack does not indicate
whether this or something else is the problem, nor does the stack trace point toward a clear
diagnosis since the searcher might have been rendered invalid earlier. It would be nice to
have more thorough assertions in Lucene code, for example verifying in entry points like {{}}
that all related objects are in a valid state, or even tracking which {{Thread}} is actively
mutating state so that definitely inappropriate calls fail early and reproducibly. Assuming
Java {{assert}} is used, this would add no runtime overhead for production code.
> 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