Hi there,

Just in case anybody would curious, the access exception is gone after we upgrade to Lucene 2.1.0.3.

Cheers,
Min

Min Yin wrote:
Hi DIGY,

That's very useful information, we see the same problem with our Lucene 2.0.0.4. Just curious if the following exceptions can also be caused by the same bug?

Error invoking RPC action: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.IOException: The process cannot access the file 'C:\Documents and Settings\Jason\caloExpressPersistence\ver-41\lucene\index\segments' because it is being used by another process.
  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
  at Lucene.Net.Store.FSIndexInput..ctor(FileInfo path)
  at Lucene.Net.Store.FSDirectory.OpenInput(String name)
  at Lucene.Net.Index.SegmentInfos.Read(Directory directory)
  at Lucene.Net.Index.IndexReader.AnonymousClassWith.DoBody()
  at Lucene.Net.Store.Lock.With.Run()
at Lucene.Net.Index.IndexReader.Open(Directory directory, Boolean closeDirectory)
  at Lucene.Net.Search.IndexSearcher..ctor(String path)

In this scenario we have two processes trying to access the same lucene index, and I think I read somewhere lucene should be process safe?

Thanks for your help!

Min

DIGY wrote:
Hi Nicolas,

I'm using Lucene.net 2.0.0 and my index file is on shared directory.
I think this is the bug in SimpleFSLockFactory  in Lucene.Net 2.0.0
See  https://issues.apache.org/jira/browse/LUCENENET-74
It is better to upgrade to 2.1

How can I save my index?
I don't know if there is a tool to recover the index, but i can propose a
solution
1-After backup, Open the segments???????? file in binary mode (~250 byte)
2-Decrement the file# counter(it is at offset 16[4 bytes])
3-delete the entry _ov0.fnm [23 bytes]

Note: I may be wrong in offsets and lengths , so it may require some
trial&error

DIGY



-----Original Message-----
From: Nicolas OLIVERO [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 5:22 PM
To: [email protected]
Subject: Cannot find file _ov0.fnm
Hi,

I'm using Lucene.net 2.0.0 and my index file is on shared directory.

All was working fine but today two users add a document at the same time.

Now when I try to search or add a document to the index I'm getting the
following error: "cannot find file _ov0.fnm".

How can I save my index?
Maybe I'm doing something wrong in my code; do I have to put a lock when I
add a document to the index (as my index is on a shared directory)?

Dim writer As IndexWriter

Dim champ As Field

Try

writer = New IndexWriter(REPERTOIRE_INDEX_FULLTEXT, New
Standard.StandardAnalyzer(), False)

      Dim leDocument As Document = New Document()

      leDocument.Add(New Field("re_id", dossier.entite.getID,
Field.Store.YES, Field.Index.NO))

leDocument.Add(New Field("rp_td_id", CStr(dossier.typedoc.rp_td_id),
Field.Store.YES, Field.Index.NO))

leDocument.Add(New Field("contenu", contenuDocument, Field.Store.YES,
Field.Index.TOKENIZED))

      Try

      writer.AddDocument(leDocument)

            '' at least on windows, some temporary files raise this
exception with an "access denied" message

            '' checking if the file can be read doesn't help

            Catch ex As FileNotFoundException

      End Try

writer.Optimize()

      writer.Close()

     Catch ex As IOException

The error occurs here ------ > MessageBox.Show("L'index Fulltext n'existe pas ou est corrompu. Reconstruisez l'index. " + ex.Message, "Erreur
index", MessageBoxButtons.OK, MessageBoxIcon.Error)

            Return False

        Catch ex As Exception

MessageBox.Show("Erreur lors de l'indexation du document car : " +
ex.Message, "Insertion impossible", MessageBoxButtons.OK,
MessageBoxIcon.Error)

            End If

            Return False

        End Try

Thanks for your help,

Nicolas


Reply via email to