lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lynn Settle <>
Subject intermittent NPE with search
Date Wed, 01 May 2013 15:30:52 GMT
Using Lucene 4.1.0, my application is designed to automatically run the exact same facet search
every few minutes, varying only by range on a date-time field. However, occasionally the app
fails with the below exception. Once this occurs, all Lucene searches begin to fail - even
if the problem index is completely closed and reopened with a new searcher. Only an app restart
makes searches functional again. It can take anywhere from hours to days for this exception
to occur. I have been unable to reproduce it in the Eclipse environment.
(Tue Apr 23 13:50:24 PST 2013) EE:ERR [LuciusDataChangeListener v0] {null-14:202} EXCEPTION:
java.lang.NullPointerException at$NumericRangeTermsEnum.accept(
at at
at at
at at
Note that line 526 is a call to nextRange(). But the stack trace stops there with no indication
of what might be null. Did it even make it into the nextRange() method?
I downloaded and compiled the Lucene 4.1.0 source. I modified NumericRangeQuery NumericRangeTermsEnum
accept method to record what value is null when this failure occurs. 
    protected final AcceptStatus accept(BytesRef term) {      try {        while (currentUpperBound
== null ||, currentUpperBound) > 0) {          if (rangeBounds.isEmpty())
           return AcceptStatus.END;          // peek next sub-range, only seek if the current
term is smaller than next lower bound          if (, rangeBounds.getFirst())
< 0)            return AcceptStatus.NO_AND_SEEK;          // step forward to next range
without seeking, as next lower range bound is less or equal current term          nextRange();
       }        return AcceptStatus.YES;      } catch (Throwable t) {        String msg; 
      if (term == null) {          msg = "term is null";        } else if (rangeBounds ==
null) {          msg = "rangeBounds is null";        } else if (termComp == null) {      
   msg = "termComp == null";        } else {          msg = "we don't know what is null!";
       }        throw new RuntimeException(msg, t);      }    }  }
When the exception occurs, msg is "we don't know what is null!". So what could possibly be
null? I'm completely lost at this point.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message