Lucene.Net
  1. Lucene.Net
  2. LUCENENET-457

Lucene locks directory with index after network related problems

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Lucene.Net Core
    • Labels:
      None
    • Environment:

      Windows Server 2008

      Description

      I have a directory for my index in shared folder on another computer in the network. My service writes data to the index. Sometimes the service gets network related exceptions like "The specified network name is no longer available.". After that the service cannot write anything to index because of lock, even if I delete "write.lock" file manually. Of course, I could restart the service, but I'd like to avoid it.

      I have done a research and have found that Lucene API has IndexWriter.Unlock() method, but in my case is does not work.
      I use NativeFSLockFactory class. Class NativeFSLock has private field LOCK_HELD with the list of current locks, but in my case (after network related issues) it has record with the lock (NativeFSLock uses it in Obtain() method) and I can't delete it through API. I suppose that method NativeFSLock.Release()(which is called from IndexWriter.Unlock()) should delete record from the field LOCK_HELD.

      May be I'm wrong and there is an appoarch to handle such problems?

      At the moment I have implemented the method which deletes the record from LOCK_HELD through reflection.

      Thanks a lot.

        Activity

        Hide
        Itamar Syn-Hershko added a comment -

        I think having the write.lock is expected - it wasn't freed after all. Manually deleting the file should work. What interests me is whether you experience a corrupt index as a result of that?

        Show
        Itamar Syn-Hershko added a comment - I think having the write.lock is expected - it wasn't freed after all. Manually deleting the file should work. What interests me is whether you experience a corrupt index as a result of that?
        Hide
        Pavel Belousov added a comment -

        We've alveady developed some additional code which deletes the file write.lock. But I think it's not the right way, because we work with the index without API.

        The problem occured a lot of times and the index was not corrupted.

        Show
        Pavel Belousov added a comment - We've alveady developed some additional code which deletes the file write.lock. But I think it's not the right way, because we work with the index without API. The problem occured a lot of times and the index was not corrupted.

          People

          • Assignee:
            Unassigned
            Reporter:
            Pavel Belousov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development