You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by DECAFFMEYER MATHIEU <MA...@fortis.lu> on 2007/03/01 09:56:25 UTC

Update - IOException

Hi,

While updating my index I have the following error :

[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R java.io.IOException:
Lock obtain timed out:
Lock@C:\TEMP\lucene-b56f455aea0a705baecaa4411d590aa2-write.lock
[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R 	at
org.apache.lucene.store.Lock.obtain(Lock.java:56)
[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R 	at
org.apache.lucene.index.IndexReader.aquireWriteLock(IndexReader.java:489
)
[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R 	at
org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:514)
[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R 	at
org.apache.lucene.index.IndexReader.deleteDocuments(IndexReader.java:541
)


I am using lucene 2.0,

When I execute the code below I find an entry with the specified Term
(it displays One Entry Found)
Then when I try to delete the document, I get the error I apsted above.

What I do is :
open a second index reader,
delete document
close second index reader
close main index reader, 
open new idnexreader

Can anyone help ?

Thank u very much.


  // Open second indexReader
  IndexReader mIndexReaderClone = null;
  try {
	mIndexReaderClone = IndexReader.open(mWorkingIndexDir);
  }
  catch (IOException exc) {
	exc.printStackTrace();
	throw new RegainException("Creating index reader failed", exc);
  }

Term urlTerm = new Term("url", url1);
Query query2 = new TermQuery(urlTerm2);
Document doc2;

  Hits hits2 = search(query2);
  if (hits2.length() > 0) {
	if (hits2.length() > 1) {
	  System.out.println("Duplicates Entries");
	}
	System.out.println("One Entry Found");
  }
  else {
	  System.out.println("No Entries");
  }

	  
	  
  try {
	mIndexReaderClone.deleteDocuments(urlTerm);
  } catch (IOException e) {
	e.printStackTrace();
	throw new RegainException("Deleting old entry failed", e);
  }
	  
  // Close the Clone IndexReader
try {
  mIndexReaderClone.close();
}
catch (IOException exc) {
  throw new RegainException("Closing index reader failed", exc);
}

__________________________________

   Matt



============================================
Internet communications are not secure and therefore Fortis Banque Luxembourg S.A. does not accept legal responsibility for the contents of this message. The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Nothing in the message is capable or intended to create any legally binding obligations on either party and it is not intended to provide legal advice.
============================================


RE: Update - IOException

Posted by Michael McCandless <lu...@mikemccandless.com>.
"DECAFFMEYER MATHIEU" <MA...@fortis.lu> wrote:
> I deleted the lock file, now it seems to work ...
>  
> When can such an error happen ?

See my response I just sent to java-user on this same error.  Even though
you are running Lucene 2.0, the same causes can lead to that "Lock obtain
timed out" exception.

Mike

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


RE: Update - IOException

Posted by DECAFFMEYER MATHIEU <MA...@fortis.lu>.
I deleted the lock file, now it seems to work ...
 
When can such an error happen ?
 
__________________________________ 

   Matt

 

________________________________

From: DECAFFMEYER MATHIEU [mailto:MATHIEU.DECAFFMAYER@fortis.lu] 
Sent: Thursday, March 01, 2007 9:56 AM
To: java-user@lucene.apache.org
Subject: Update - IOException


***** This message comes from the Internet Network *****



Hi, 

While updating my index I have the following error : 

[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R java.io.IOException:
Lock obtain timed out:
Lock@C:\TEMP\lucene-b56f455aea0a705baecaa4411d590aa2-write.lock

[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R       at
org.apache.lucene.store.Lock.obtain(Lock.java:56) 
[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R       at
org.apache.lucene.index.IndexReader.aquireWriteLock(IndexReader.java:489
)

[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R       at
org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:514)

[3/1/07 9:44:19:214 CET] 76414c82 SystemErr     R       at
org.apache.lucene.index.IndexReader.deleteDocuments(IndexReader.java:541
)


I am using lucene 2.0, 

When I execute the code below I find an entry with the specified Term 
(it displays One Entry Found) 
Then when I try to delete the document, I get the error I apsted above. 

What I do is : 
open a second index reader, 
delete document 
close second index reader 
close main index reader, 
open new idnexreader 

Can anyone help ? 

Thank u very much. 


  // Open second indexReader 
  IndexReader mIndexReaderClone = null; 
  try { 
        mIndexReaderClone = IndexReader.open(mWorkingIndexDir); 
  } 
  catch (IOException exc) { 
        exc.printStackTrace(); 
        throw new RegainException("Creating index reader failed", exc); 
  } 

Term urlTerm = new Term("url", url1); 
Query query2 = new TermQuery(urlTerm2); 
Document doc2; 

  Hits hits2 = search(query2); 
  if (hits2.length() > 0) { 
        if (hits2.length() > 1) { 
          System.out.println("Duplicates Entries"); 
        } 
        System.out.println("One Entry Found"); 
  } 
  else { 
          System.out.println("No Entries"); 
  } 

          
          
  try { 
        mIndexReaderClone.deleteDocuments(urlTerm); 
  } catch (IOException e) { 
        e.printStackTrace(); 
        throw new RegainException("Deleting old entry failed", e); 
  } 
          
  // Close the Clone IndexReader 
try { 
  mIndexReaderClone.close(); 
} 
catch (IOException exc) { 
  throw new RegainException("Closing index reader failed", exc); 
} 

__________________________________ 

   Matt 



============================================
Internet communications are not secure and therefore Fortis Banque
Luxembourg S.A. does not accept legal responsibility for the contents of
this message. The information contained in this e-mail is confidential
and may be legally privileged. It is intended solely for the addressee.
If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on
it, is prohibited and may be unlawful. Nothing in the message is capable
or intended to create any legally binding obligations on either party
and it is not intended to provide legal advice.
============================================