Why am I receiving a time out for the Lucene write.lock file?

Overview

The search crawler indexes content to physical index files, while it is running and this process can timeout or lock up.

 

Prerequisites

  • Access to a SuperUser or an Administrator account.

 

Diagnosis

When files inside the Search folder get corrupted for whatever reason, customers may see the following error in the log4net log file of DNN:

Lock obtain timed out: NativeFSLock@<root_folder>\App_Data\Search\write.lock

at Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout)at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, IndexDeletionPolicy deletionPolicy, Int32 maxFieldLength, IndexingChain indexingChain, IndexCommit commit)
at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a, MaxFieldLength mfl) at DotNetNuke.Services.Search.Internals.LuceneControllerImpl.get_Writer()
at DotNetNuke.Services.Search.Internals.LuceneControllerImpl.Delete(Query query) at DotNetNuke.Services.Search.Internals.InternalSearchControllerImpl.DeleteSearchDocumentInternal(SearchDocument searchDocument, Boolean autoCommit)
at DotNetNuke.Services.Search.Internals.InternalSearchControllerImpl.DeleteAllDocuments(Int32 portalId, Int32 searchTypeId)
at DotNetNuke.Services.Search.SearchEngine.DeleteOldDocsBeforeReindex() at DotNetNuke.Services.Search.SearchEngineScheduler.DoWork()

The error is because the indexing scheduler is being blocked by another process. When the write.lock file exists in the Search folder, it means it's currently writing to an index file.

Deleting the write.lock file or interrupting this indexing process would corrupt the files, causing the "Lock obtain timed out" error to be displayed in the log4net log files.

 

Solution

  1. To resolve this, you will need to recycle the application pool through IIS by going into IIS > Click on Application Pools > Right-click on the application pool for your website > Recycle.
  2. After recycling the application pool, run a reindex on your site.
  3. If the above steps did not resolve your issue, run a full Reindex and You can go to Settings > Scheduler > Scheduler > Manually run the Search Crawlers (File, Site, URL).

 

Testing

To test that the write.lock timeout has been resolved:

  1. Go to Settings > Scheduler > History and see if the crawler task was completed successfully.
  2. Check the Log4net files for the error again located in SiteRoot/Portals/_default/Logs folder.

Comments

0 comments

Article is closed for comments.