+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / access to path...write.lock is denied

access to path...write.lock is denied

10 posts, 0 answered
  1. bleutiger
    bleutiger avatar
    153 posts
    Registered:
    23 Oct 2008
    08 Apr 2010
    Link to this post
    Ok I know what everyone is thinking....that I need to add permissions for the ASP.net user and all will be well.

    Unfortunately I have already done this and I even had the hosting company recheck it on their end.

    What I am trying to do is wipe out all indexes and start over.  This error occurs when I try to create a new index.

    Access to the path 'D:\inetpub\autoconn\App_Data\Search\test\Index\write.lock' is denied.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\inetpub\autoconn\App_Data\Search\test\Index\write.lock' is denied.

    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [UnauthorizedAccessException: Access to the path 'D:\inetpub\autoconn\App_Data\Search\test\Index\write.lock' is denied.]
       System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7714255
       System.IO.File.Delete(String path) +7574888
       Telerik.Lucene.Net.Store.SimpleFSLock.Release() +39
       Telerik.Lucene.Net.Index.IndexWriter.Close() +70
       Telerik.Search.Engine.SearchManager.EnsureDirectoriesExist(String IndexingService) +59
       Telerik.Search.Engine.SearchManager.GetIndexingStatistics(String Provider) +18
       Telerik.Search.WebControls.Admin.ControlPanel.Indexes_ItemDataBound(Object sender, RepeaterItemEventArgs e) +323
       System.Web.UI.WebControls.Repeater.OnItemDataBound(RepeaterItemEventArgs e) +108
       System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +136
       System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +443
       System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +51
       System.Web.UI.WebControls.Repeater.DataBind() +75
       Telerik.Search.WebControls.Admin.ControlPanel.LoadMainScreenTemplate() +383
       Telerik.Search.WebControls.Admin.ControlPanel.CreateChildControls() +54
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


    If I look in the app_data folder  it seems to create everything fine.

    the wierd thing is that if I refresh the page it says the index has already been created and I look in the dashboard and sure enough it has made the index.  I can edit the index but if I try to delete it I get this message

    Access to the path 'segments.gen' is denied.

    Stack Trace:

    [UnauthorizedAccessException: Access to the path 'segments.gen' is denied.]
       System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive) +2286853
       System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive) +203
       System.IO.DirectoryInfo.Delete(Boolean recursive) +24
       Telerik.Search.WebControls.Admin.ControlPanel.DeleteServiceHolder(String serviceName) +139
       Telerik.Search.WebControls.Admin.ControlPanel.Service_Command(Object sender, CommandEventArgs e) +505
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +108
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
    


    but when I return to the indexes page it has indeed been deleted.

    Very frustrating .
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Apr 2010
    Link to this post
    Hello bleutiger,

    Here is how the Lucene engine works. There are two classes in Lucene which methods make locking

    • Telerik.Lucene.Net.Store.FSDirectory class  - GetDirectory method. The method forces write lock  
    • NativeFSLockFactory classes.


    Lucene also uses the Temp Windows folder in its background, so the ASP.NET account needs write permissions there
    The locking is used by Lucene API, bacause this caches the directories and ensures that there is a unique Directory,  so that synchronization on the Directory can be used to synchronize access between readers and writers. When you run the index the files from the Search folder get locked because Lucene reads them. The lock ensures that one thread does not enter a critical section of code while another thread is in the same section.

    The error you are getting is because Lucene or other application is locked segments file and until the process that is being conducted  complete the file will not be unlocked.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. bleutiger
    bleutiger avatar
    153 posts
    Registered:
    23 Oct 2008
    17 May 2010
    Link to this post
    I know this is an older post but many projects have grabbed my attention lately and I am just now getting back to this.

    I am still having issues with this.

    These are the steps I have taken so far to try and resolve.

    I i access IIS on my production server and confirmed that the ASPNET user has read, write, execute, and delete permissions for every folder and subfolder on my entire site.

    I have deleted the search indexes from the dashboard and manually deleted via ftp the search folder contents

    I have recreated an index and recieved an error saying

    Cannot create directory: D:\inetpub\autoconn\App_Data\Search\SiteIndex3\Index

    I logged into my sql server to view the data in the database and there is data in the database for the new index I have created.

    I have confirmed with the hosting company that permissions have indeed been set on the appropriate folders.

    What else can I do to get this working.

    This is the last step in my project and I want to put it to bed.
  4. bleutiger
    bleutiger avatar
    153 posts
    Registered:
    23 Oct 2008
    17 May 2010
    Link to this post
    Ok nevermind problem solved.

    It was an issue on the server of my hosting company.  Evidently Sitefinity requires more permissions than I was able to set in their dashboard utility.
  5. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    15 Oct 2010
    Link to this post
    Hi Ivan,

    I am having the same issue as this and not gotten it to work yet.

    This is what I have done:

    Checked that c:\Windows\Temp has the ASPNET account set on it and that it has full access.
    Checked that the folder App_Data has the ASPNET account set on it and that it has full access.

    I have done this on my local machine as well as the production server but still getting the same error.

    I see that there is an Special Permissions tick box which is what bleutiger might have had to do but this option is not available to me.

    Any ideas?

    As a side note, most of these errors have started since I upgraded to SP4 (if that help you)

    Cheers,
    James


  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 Oct 2010
    Link to this post
    Hi James,

    Can you please make sure that your Application pool in which the website is running is using the ASP.NET identity. It may be using Network Service or other account. If it is using Network Service you should grant the permissions for this account. Also check if you have ASP.NET impersonation enabled, if you have try disabling it.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    19 Oct 2010
    Link to this post
    Hi Radaslov,

    Thanks for getting back to me. Yes, it is as you mentioned that the Application Pool is not using the ASP.NET identity. Can you please tell me how to add this to IIS on our production server as I do not see any options for this.

    Thanks
    James
  8. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    19 Oct 2010
    Link to this post
    Hi Radaslov,

    Here's the Stack Trace I get for this error. Hope this helps you?



    [IOException: Lock obtain timed out: SimpleFSLock@C:\Inetpub\wwwroot\client.ourweb.com\SP4\App_Data\Search\Everything\Index\write.lock]
       Telerik.Lucene.Net.Store.Lock.Obtain(Int64 lockWaitTimeout) +370
       Telerik.Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, Boolean closeDir) +112
       Telerik.Lucene.Net.Index.IndexWriter..ctor(String path, Analyzer a, Boolean create) +252
       Telerik.Search.Engine.Crawler.GetIndexWriter(String indexName, Boolean createIndex) +91
       Telerik.Search.Engine.BaseIndexer..ctor(String directory, String provider, Boolean appendToIndex) +51
       Telerik.Search.Engine.HtmlIndexer..ctor(String directory, String provider, Boolean appendToIndex) +25
     
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
       System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) +0
       System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) +15
       System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +249
       System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051
       System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
       Telerik.Search.Engine.SearchManager.GetFields(String provider) +313
       Telerik.Search.Engine.SearchManager.Search(String searchQuery, String indexName, Int32 startIndex, Int32 max, String mode, Boolean escapeChars, Int32& totalItems) +41
       Telerik.Search.WebControls.SearchResult.CreateChildControls() +456
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


    Thanks,
    James
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Oct 2010
    Link to this post
    Hello James,

    You are using SearchResult control at the same time that an index is being performed or the index has left locked from your last query. The lock ensures that one thread does not enter a critical section of code while another thread is in the same section. Try granting ASP.NET or NETWORKSERVICE (application pool and file system) with full access over App_Data folder.
    Possible reasons for this behavior are

    1. You do not have enough permissions
    2. There is a storage issue
    3. You are trying to use the index in two or more threads
    4. You could try to remove the auto index for pages and conduct searching over the website once or twice a day.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    19 Oct 2010
    Link to this post
    Thanks Ivan I will try this and let you know how things go!

    Cheers
Register for webinar
10 posts, 0 answered