Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

NPE in IndexReader

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


eric.louvard at hauk-sasko

Aug 21, 2007, 1:10 AM

Post #1 of 7 (2506 views)
Permalink
NPE in IndexReader

Hello while calling IndexReader.deletedoc(int) I am becomming a NPE.

java.lang.NullPointerException
at
org.apache.lucene.index.IndexReader.acquireWriteLock(IndexReader.java:658)
at
org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:686)

In the acquireWriteLock methode there is call
'segmentInfos.getVersion()', but segmentInfos should be 'null'.

I am working with the head revision from SVN.

May someone tell me a work arround.

regards, Éric Louvard.

--
Mit freundlichen Grüßen

i. A. Éric Louvard
HAUK & SASKO Ingenieurgesellschaft mbH
Zettachring 2
D-70567 Stuttgart

Phone: +49 7 11 7 25 89 - 19
Fax: +49 7 11 7 25 89 - 50
E-Mail: eric.louvard [at] hauk-sasko
www: www.hauk-sasko.de
Niederlassung Stuttgart
Firmensitz: Markstr. 77, 44801 Bochum
Registergericht: Amtsgericht Bochum, HRB 2532
Geschäftsführer: Dr.-Ing. Pavol Sasko





---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


buschmic at gmail

Aug 21, 2007, 2:40 PM

Post #2 of 7 (2421 views)
Permalink
Re: NPE in IndexReader [In reply to]

Eric Louvard wrote:
> Hello while calling IndexReader.deletedoc(int) I am becomming a NPE.
>
> java.lang.NullPointerException
> at
> org.apache.lucene.index.IndexReader.acquireWriteLock(IndexReader.java:658)
> at
> org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:686)
>
> In the acquireWriteLock methode there is call
> 'segmentInfos.getVersion()', but segmentInfos should be 'null'.
>
> I am working with the head revision from SVN.
>
> May someone tell me a work arround.
>
> regards, Éric Louvard.
>

Hi Eric,

could you please provide more information about how exactly you create
the IndexReader? A unit test that hits this exception would be even better!

Thanks,
- Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


chris.lu at gmail

Aug 21, 2007, 2:52 PM

Post #3 of 7 (2423 views)
Permalink
Re: NPE in IndexReader [In reply to]

Hi, Eric, I think I have the same problem.

I found out in latest MultiReader.java, the "SegmentInfos" is set to null.

public MultiReader(IndexReader[] subReaders) throws IOException {
super(subReaders.length == 0 ? null : subReaders[0].directory(),
null, false, subReaders);
}

However, segmentInfos are used in several places, causing NPEs.
For example, in IndexReader.acquireWriteLock(),

if (SegmentInfos.readCurrentVersion(directory) >
segmentInfos.getVersion())
{

So I think MultiReader.java need some adjustments.


--
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes:
http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes


On 8/21/07, Michael Busch <buschmic [at] gmail > wrote:
>
> Eric Louvard wrote:
> > Hello while calling IndexReader.deletedoc(int) I am becomming a NPE.
> >
> > java.lang.NullPointerException
> > at
> > org.apache.lucene.index.IndexReader.acquireWriteLock(IndexReader.java
> :658)
> > at
> > org.apache.lucene.index.IndexReader.deleteDocument (IndexReader.java
> :686)
> >
> > In the acquireWriteLock methode there is call
> > 'segmentInfos.getVersion()', but segmentInfos should be 'null'.
> >
> > I am working with the head revision from SVN.
> >
> > May someone tell me a work arround.
> >
> > regards, Éric Louvard.
> >
>
> Hi Eric,
>
> could you please provide more information about how exactly you create
> the IndexReader? A unit test that hits this exception would be even
> better!
>
> Thanks,
> - Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


hossman_lucene at fucit

Aug 21, 2007, 5:06 PM

Post #4 of 7 (2397 views)
Permalink
Re: NPE in IndexReader [In reply to]

: I found out in latest MultiReader.java, the "SegmentInfos" is set to null.

: However, segmentInfos are used in several places, causing NPEs.
: For example, in IndexReader.acquireWriteLock(),

MultiReader was refactored into two classes: MultiReader which is now only
constructed from other readers, and MultiSegmentReader which is what
IndexReader.open returns when a directory contans multiple segments ...
segmentInfos shouldn't be needed in the first case -- and doesn't make
much sense at all.



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


chris.lu at gmail

Aug 21, 2007, 5:17 PM

Post #5 of 7 (2412 views)
Permalink
Re: NPE in IndexReader [In reply to]

Right now I am very confused.

I agree segmentInfos are not needed in this case. But it's used in
aquireWriteLock(). What should we do?

--
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes:
http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes

On 8/21/07, Chris Hostetter <hossman_lucene [at] fucit> wrote:
>
>
> : I found out in latest MultiReader.java, the "SegmentInfos" is set to
> null.
>
> : However, segmentInfos are used in several places, causing NPEs.
> : For example, in IndexReader.acquireWriteLock(),
>
> MultiReader was refactored into two classes: MultiReader which is now only
> constructed from other readers, and MultiSegmentReader which is what
> IndexReader.open returns when a directory contans multiple segments ...
> segmentInfos shouldn't be needed in the first case -- and doesn't make
> much sense at all.
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


hossman_lucene at fucit

Aug 21, 2007, 7:12 PM

Post #6 of 7 (2390 views)
Permalink
Re: NPE in IndexReader [In reply to]

: I agree segmentInfos are not needed in this case. But it's used in
: aquireWriteLock(). What should we do?

This is one of the reasons why i was suggesting in a java-dev thread that
*all* of the refrences to SegmentInfos be refactored out of IndexReader
and into the subclasses -- any attempt to access the SegmentInfos in a
MultiReader constructed from an IndexReader[] doesn't make sense -- and it
never has. In past releases, any operation in a MultiReader constructed
from subReaders that attempted to use SegmentInfos (like aquireWriteLock)
would never work properly (at best it would lock the first subReader)

...hmm, looking at this more and getting more confused...

I was going to say that this was all a red herring and couldn't cause the
NPE, since the only time acquireWriteLock is (or ever has been) called is
when the IndexReader knows it owns the directory, but a quick skim of
MultiReader on the trunk to try and find where it tells the super class it
doesn't own the directory made me realize it's not there ... MultiReader
extends MultiSegmentReader and passes info up the chain of super
constructors about ot closing the Directory on close, but there is no info
passed up about not owning the directory.

skimming 2.2 i don't see how this ever worked "corectly" ... it wouldn't
NPE, but it looks like any attempt at doing anything on a MultiReader
would always aqcuire the write lock on the *first* sub reader, then
delegate to the correct subreader.

it appears that this is yet another flaw in the old impl exposed via the
refactoring done so far (and further motivation for continued refactoring
untill IndexReader is a glorified abstract class with no meat in it)

(can someone sanity check my assessment ... i'm a little dizzy from
flipping back and forth between various versions of IndexReader,
MultiReader and MultiSegmentReader)




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


buschmic at gmail

Aug 22, 2007, 1:11 AM

Post #7 of 7 (2401 views)
Permalink
Re: NPE in IndexReader [In reply to]

Chris Hostetter wrote:
>
> This is one of the reasons why i was suggesting in a java-dev thread that
> *all* of the refrences to SegmentInfos be refactored out of IndexReader
> and into the subclasses -- any attempt to access the SegmentInfos in a

OK, I'm convinced that we should refactor segmentInfos into the
subclasses. I'll open a JIRA issue and take it.



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.