lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject RE: InputStream handling problem
Date Thu, 25 Apr 2002 03:36:40 GMT
Ah, sorry.  After I hit sent I realized that I should have cleared my
CLASSPATH, as it was old jar, with the old RAMDirectory, that was being
used.

I do get the error now:
java.lang.Error: Cannot delete file while there's interest in it
	at
org.apache.lucene.store.RAMDirectory.deleteFile(RAMDirectory.java:145)
	at
org.apache.lucene.index.IndexWriter.deleteFiles(IndexWriter.java:364)
	at
org.apache.lucene.index.IndexWriter.deleteSegments(IndexWriter.java:345)
	at org.apache.lucene.index.IndexWriter.access$200(IndexWriter.java:87)
	at org.apache.lucene.index.IndexWriter$2.doBody(IndexWriter.java:325)
	at org.apache.lucene.store.Lock$With.run(Lock.java:116)
	at
org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:322)
	at
org.apache.lucene.index.IndexWriter.maybeMergeSegments(IndexWriter.java:283)
	at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:185)
	at
org.apache.lucene.ThreadSafetyTest$IndexerThread.run(ThreadSafetyTest.java:112)


Well, you may be onto something, although I don't see the culprit yet.
At first I thought you forgot to add this in RAMDirectory:

  public final OutputStream createFile(String name) {
    RAMFile file = new RAMFile();
    files.put(name, file);
    // OG
    incInterest(name);     // this
    return new RAMOutputStream(file, name);
  }

However, that causes the error to happen right away, which I didn't
expect, as I am increasing 'interest'.  Oh, I see, you are increasing
it in RAMOutputStream constructor...

Hm, well, it looks like I am only able to confirm your observations:

[otis@linux2 classes]$ java org.apache.lucene.ThreadSafetyTest &> o.log
[otis@linux2 classes]$ grep Error o.log 
java.lang.Error: Cannot delete file while there's interest in it:
_b.fdx
[otis@linux2 classes]$ 
[otis@linux2 classes]$ grep _b.fdx o.log 
Increased interest in _b.fdx to 1
Decreased interest in _b.fdx to 0
Increased interest in _b.fdx to 1
Increased interest in _b.fdx to 2
Increased interest in _b.fdx to 3
Decreased interest in _b.fdx to 2
Increased interest in _b.fdx to 3
Increased interest in _b.fdx to 4
Increased interest in _b.fdx to 5
Increased interest in _b.fdx to 6
Decreased interest in _b.fdx to 5
Increased interest in _b.fdx to 6
Increased interest in _b.fdx to 7
Increased interest in _b.fdx to 8
Decreased interest in _b.fdx to 7
Increased interest in _b.fdx to 8
java.lang.Error: Cannot delete file while there's interest in it:
_b.fdx
Decreased interest in _b.fdx to 7

It looks like the number of places where you increase interest, and
where you decrease or drop it, is balanced.  The super class of
RAMDirectory has all abstract methods, so nothing is happening there.

I don't know, are you sure that what you are seeing really is a
problem, that it is wrong to get rid of a file for which there is
interest?
It sounds logical, but maybe Doug wrote something that we can't find
that makes this an okay thing to do.
If this is a bug I wonder how come more people haven't complained about
it...

Sorry I couldn't help more, maybe somebody else can find the problem.

Otis



--- Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> Hello,
> 
> I just used your classes (I picked the ones that looked right), run
> ThreadSafetyTest, but I can't get it to throw any Errors/Exceptions.
> 
> I can send you the 2 .java files I picked from the 4 that you sent,
> perhaps I picked the wrong ones...
> 
> Otis
> 
> 
> --- Roman Rokytskyy <rrokytskyy@yahoo.co.uk> wrote:
> > > Please send a test case, that will be really helpful.
> > 
> > Thanks for quick reply.
> > 
> > In attachment you will find two modified classes from latest CVS
> > update.
> > Please comment out/remove references to JDSDirectory if any (they
> are
> > copies
> > from my working env, and JDSDirectory depends on JDataStore
> classes,
> > therefore its not included).
> > 
> > Best regards,
> > Roman Rokytskyy
> > 
> 
> > ATTACHMENT part 2 application/x-javascript
> name=ThreadSafetyTest.java
> 
> 
> > ATTACHMENT part 3 application/x-javascript name=RAMDirectory.java
> 
> 
> > ATTACHMENT part 4 application/x-javascript name=RAMDirectory.java
> 
> 
> > ATTACHMENT part 5 application/x-javascript
> name=ThreadSafetyTest.java
> > --
> > To unsubscribe, e-mail:  
> > <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:lucene-dev-help@jakarta.apache.org>
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
> 
> --
> To unsubscribe, e-mail:  
> <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-dev-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message