lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: JVM Crash in Lucene
Date Fri, 09 Dec 2005 02:49:08 GMT
: I'm relatively new to Lucene.  When I run my app, I get a JVM error.
: This gets called a lot, but only fails every once in awhile (maybe 1 in
: 100 calls?)

i'm not that familiar with TermFreqVectors, and I have no idea what
indexManager is, but I'm suprised this works at all ... I thought calling
the getters on a TermFreqVector required it to read from the underlying
files (which would require that the reader still be open).

Is it possible that that's your problem? .. is there perhaps some strange
GC interaction issue that results in the data TermFreqVector is looking
for to go bye-bye because you closed the reader?

(it sounds silly when I read it back to myself ... but it's the best guess
i've got just reading your code)

: My code that is causing the JVM crash is:
:
:          //Get the terms and frequencies
:          IndexReader indexreader = null;
:          TermFreqVector tv = null;
:          try {
:              indexreader = indexManager.getIndexReader();
:              tv = indexManager.getTermVector(indexreader, item);
:              if(null==tv) {
:                  if(log.isErrorEnabled()) log.error("No term vector for item " + item.getId());
:                  //??? better handling
:                  return;
:              }
:          }
:          finally {
:              //XXX should close earlier
:              if(null!=indexreader) {
:                  try {
:                      indexreader.close();
:                  }
:                  catch(IOException ex) {
:                      if(log.isDebugEnabled()) log.debug("IOException cleaning up indexreader
", ex);
:                  }
:              }
:          }
:
:          //Replace the String[] with its equivalent long[]... (and tally up total occurs)
:          String[] termstrings = tv.getTerms();
:          int[] freqs = tv.getTermFrequencies();




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message