4 Replies Latest reply: Jun 12, 2012 11:18 PM by Neil Zou RSS

    IndexWriter is not closed after shutdown repository in 3.0.0.Alpha4

    Neil Zou Newbie

      A lucene lock file write.lock is left in the index directory after I shutdown JcrEngine, I found IndexWriter is not closed by call below code.

       

      engine.shutdown().get();
      

       

      Do we need to close IndexWriter ourselves, and how?

        • 1. Re: IndexWriter is not closed after shutdown repository in 3.0.0.Alpha4
          Randall Hauch Master

          You should not have to close the index writer. Does the lock file stick around after JVM exit? Or does it impede startup or (after startup) prevent more updates from being indexed properly? If so, then can you please log a bug in our JIRA because it may be an issue with Hibernate Search (which we're using to perform all index updates, and our code doesn't even touch IndexWriters) or how we're using it (e.g., not properly shutting down the Hibernate Search engine when ModeShape is shutdown).

          • 2. Re: IndexWriter is not closed after shutdown repository in 3.0.0.Alpha4
            Neil Zou Newbie

            Yes, the lock file still there after JVM exit and prevents more updates after restart JcrEngine. Below is the error:

             

            Jun 11, 2012 1:22:00 PM org.hibernate.search.exception.impl.LogErrorHandler handleException
            ERROR: HSEARCH000058: Exception occurred org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@\dev\index\nodeinfo\write.lock
            Primary Failure:
                Entity org.modeshape.jcr.query.lucene.basic.NodeInfo  Id 07c17757505d64f99f7a54-dff5-4fa6-b97f-a0f9e18baf16  Work Type  org.hibernate.search.backend.UpdateLuceneWork
            Subsequent failures:
                Entity org.modeshape.jcr.query.lucene.basic.NodeInfo  Id 07c17757505d641aa38eb1-de6f-400b-933c-3ea343de9466  Work Type  org.hibernate.search.backend.AddLuceneWork
                Entity org.modeshape.jcr.query.lucene.basic.NodeInfo  Id 07c17757505d6409a0d17a-8902-40d7-9b22-289827d5fdff  Work Type  org.hibernate.search.backend.AddLuceneWork
            
            org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@\dev\index\nodeinfo\write.lock
                at org.apache.lucene.store.Lock.obtain(Lock.java:84)
                at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1108)
                at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.createNewIndexWriter(IndexWriterHolder.java:127)
                at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.getIndexWriter(IndexWriterHolder.java:102)
                at org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl.getIndexWriter(AbstractWorkspaceImpl.java:119)
                at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:99)
                at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)
            Jun 11, 2012 1:22:00 PM org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask applyUpdates
            ERROR: HSEARCH000072: Couldn't open the IndexWriter because of previous error: operation skipped, index ouf of sync!
            
            • 3. Re: IndexWriter is not closed after shutdown repository in 3.0.0.Alpha4
              Randall Hauch Master

              Can you please log a defect. If we're properly shutting down the Hibernate Search engine, then we'll work with the HS community to see where the problem might be. Thanks.