Installation and deployment
Version 7.x > Installation and deployment > SmartSearch Locking View modes: 
User avatar
Member
Member
bryanallott - 10/21/2013 11:14:39 AM
   
SmartSearch Locking
I'm now frequently getting a
"Cannot access a closed file. " while performing a search using "any words"

Stack trace is typically:
Message: Cannot access a closed file. 
Stack Trace:
at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
at Lucene.Net.Index.SegmentTermDocs.Seek(TermInfo ti)
at Lucene.Net.Index.SegmentTermDocs.Seek(Term term)
at Lucene.Net.Index.MultiTermDocs.TermDocs(Int32 i)
at Lucene.Net.Index.MultiTermDocs.Read(Int32[] docs, Int32[] freqs)
at Lucene.Net.Search.TermScorer.Score(HitCollector c, Int32 end)
at Lucene.Net.Search.TermScorer.Score(HitCollector hc)
at Lucene.Net.Search.IndexSearcher.Search(Weight weight, Filter filter, HitCollector results)
at Lucene.Net.Search.IndexSearcher.Search(Weight weight, Filter filter, Int32 nDocs)
at Lucene.Net.Search.MultiSearcher.Search(Weight weight, Filter filter, Int32 nDocs)
at Lucene.Net.Search.Hits.GetMoreDocs(Int32 min)
at Lucene.Net.Search.Hits.HitDoc(Int32 n)
at Lucene.Net.Search.Hits.Doc(Int32 n)
at CMS.SiteProvider.SearchHelper.FilterResults(Hits results, Boolean checkPermissions, Boolean combineWithDefaultCulture, String culture, String defaultCulture, Int32 maxResults, UserInfo user, Hashtable documents, List`1 inRoles, List`1 notInRoles)
at CMS.SiteProvider.SearchHelper.Search(SearchParameters parameters)
at CMSModules_SmartSearch_SearchIndex_Search.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Rebuilding the index generally solves the issue, but it comes up every other day and the search breaks. For the most part, the search is pretty standard and out the box- a couple of document classes, one site, one culture. ±3500 documents in total, ±7MB index.

There is ample space on the disk and the network service has write access to the Smartsearch folder, it's not also a read-only folder. Any ideas?

User avatar
Kentico Legend
Kentico Legend
Accepted solutionAccepted solution
Brenden Kehren - 10/21/2013 12:19:19 PM
   
RE:SmartSearch Locking
Bryan,

I think this will help you with your issue, specifically the CMSSmartSearchLockPollInterval and CMSSmartSearchLockTimeout keys. I had the simlar issue with a smaller site and it took some trial and error but we were able to get the proper setting configured without going too high or low.

Brenden

User avatar
Member
Member
bryanallott - 10/21/2013 4:35:26 PM
   
RE:SmartSearch Locking
Thank you, Brenden!
That certainly looks like it should help. I'll play with those for sure. Much obliged :)

User avatar
Member
Member
bryanallott - 10/30/2013 3:41:54 AM
   
RE:SmartSearch Locking
For what it's worth, it **seems** that Windows Explorer was locking out the index files from time to time (and a lot more frequently as of late). I ended up running Process Monitor on the folder to see what other processes were interfering with the search engine index files and Explorer came out tops. Of course, it could be another system dll running in the shell (anti-virus? versioning? backups?), I didn't dig too far down....

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 10/30/2013 2:54:15 PM
   
RE:SmartSearch Locking
Does the server(s) have Microsoft DFS running on them? I don't remember if you said it was a webfarm or not. Could be that DFS is locking them while they are syncing from server to server.