Posted by: BWG - Wednesday, 12 April 2023 07:51:13
When posting a reply to a post the following error on my forum is now being thrown. I've not made any changes to the forum code in the last couple of weeks and am am running 3.1.13. Any ideas what the cause could be?
[b]Edit: By using Resource Monitor on Windows Server I can see the \App_Data\search_index\write.lock is being locked by the w3wp.exe process. If I restart the process the problem goes away, but presumably it will return quickly. Complete guess on my part, but could it be there is something in one of the recent posts which is causing the process to lock?
Edit 2: In the file \yafsrc\YAF.Core\Services\Search.cs I've commented out calls to [i]private IndexWriter Writer{} as a temporary (hopefully) work around[/i][/b]
[code=markup]System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.IOException: The process cannot access the file 'F:\wwwroot\yaf_3_1_13_compiled\App_Data\search_index\write.lock' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at YAF.Lucene.Net.Store.SimpleFSLock.Dispose(Boolean disposing) in C:\inetpub\wwwroot\YAFNET-3_1_13_source\yafsrc\Lucene.Net\Lucene.Net\Store\SimpleFSLockFactory.cs:line 169
at YAF.Lucene.Net.Store.Lock.Dispose() in C:\inetpub\wwwroot\YAFNET-3_1_13_source\yafsrc\Lucene.Net\Lucene.Net\Store\Lock.cs:line 159
at YAF.Lucene.Net.Index.IndexWriter.Unlock(Directory directory) in C:\inetpub\wwwroot\YAFNET-3_1_13_source\yafsrc\Lucene.Net\Lucene.Net\Index\IndexWriter.cs:line 6126
at YAF.Core.Services.Search.get_Writer() in C:\inetpub\wwwroot\YAFNET-3_1_13_source\yafsrc\YAF.Core\Services\Search.cs:line 144
at YAF.Core.Services.Search.AddSearchIndexItem(SearchMessage message) in C:\inetpub\wwwroot\YAFNET-3_1_13_source\yafsrc\YAF.Core\Services\Search.cs:line 288
at YAF.Core.Model.MessageRepositoryExtensions.SaveNew(IRepository`1 repository, Forum forum, Topic topic, User user, String message, String guestUserName, String ipAddress, DateTime posted, Nullable`1 replyTo, MessageFlags flags) in C:\inetpub\wwwroot\YAFNET-3_1_13_source\yafsrc\YAF.Core\Model\MessageRepositoryExtensions.cs:line 1012
at YAF.Pages.PostMessage.PostReplyHandleReplyToTopic(Boolean isSpamApproved)
at YAF.Pages.PostMessage.PostReply_Click(Object sender, EventArgs e)
at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Util.WithinCancellableCallbackTaskAwaitable.WithinCancellableCallbackTaskAwaiter.GetResult()
at System.Web.UI.Page.<ProcessRequestAsync>d__515.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.UI.Page.<ProcessRequestAsync>d__554.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)[/code]
Posted by: tha_watcha - Thursday, 13 April 2023 09:02:49
[quote]When posting a reply to a post the following error on my forum is now being thrown. I've not made any changes to the forum code in the last couple of weeks and am am running 3.1.13. Any ideas what the cause could be? [/quote]
Well if the write.lock exists it means the Search updater is running. So i would assume the problem would only occur bettwen 2-3 am in the seconds or minutes when the task runs. Easiest solution at the moment would be to add a catch handler so posting would be no problem.