access to ClientsCacheLock is denied

16 posts, 0 answers
  1. Joseph
    Joseph avatar
    1 posts
    Member since:
    Oct 2014

    Posted 18 Jan 2015 Link to this post

    I'm trying to deploy my ASP.NET MVC app that uses Telerik Reporting.  When trying to run a report on the test server I get an error:

    Internal Server Error:
    An error has occurred.
    Access to the path '8.2.14.1027_ClientsCacheLock' is denied.

    Can you provide direction on solving this problem?

    Thank you
  2. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 21 Jan 2015 Link to this post

    Hello Joseph,

    If the Reporting REST service will be hosted on multiple instances, you need to use the IStorage CreateStorage method instead of the ICache CreateCache method of the service - REST Service storage.

    In case the service is hosted as a single instance, you can use the ICache CreateCache method of the Reporting REST service, where the application's process must have proper read/write access to the cache storage. You can set a specific folder where the service will store (cache) the data through the CacheFactory.CreateFileCache Method (String). Thus different processes (applications using the Reporting REST service) will not use the same default cache folder.

    On a side note, if the service will be hosted separately, and will use a different domain you may need to enable CORS to allow the communication between the clients(viewers) and the service.


    Let us know if you need any further help.


    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Travis Lamkin
    Travis Lamkin avatar
    3 posts
    Member since:
    May 2010

    Posted 10 Feb 2015 in reply to Stef Link to this post

    Stef,

    Starting today, we have run into this same error.  On our Dev/QA server, we have 2 websites running (separate IIS site, separate ApplicationPools) that run 2 different versions of our code.  Whichever website is accessed first, reporting worked as expected.  The 2nd website fails (exception message shown below).  I made code changes to both branches to specify the folder structure (based on the web.config) so that it is different between the 2 (C:\ReportCache1 and C:\ReportCache2).

    {"message":"An error has occurred.","exceptionMessage":"Access to the path '8.2.14.1027_ClientsCacheLock' is denied.",
    "exceptionType":"System.UnauthorizedAccessException","stackTrace":"   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n  
    at System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)\r\n   at
    System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)\r\n  
    at System.Threading.Mutex.CreateMutexWithGuaranteedCleanup(Boolean initiallyOwned, String name, Boolean& createdNew, SECURITY_ATTRIBUTES secAttrs)\r\n  
    at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)\r\n  
    at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew)\r\n  
    at Telerik.Reporting.Services.Engine.CacheStorage.Lock..ctor(String key)\r\n  
    at Telerik.Reporting.Services.Engine.CacheStorage.GetAllMembersInSet(String key)\r\n  
    at Telerik.Reporting.Services.Engine.ReportEngine.ClearExpiredClients()\r\n  
    at Telerik.Reporting.Services.Engine.ReportEngine.RegisterClient()\r\n  
    at Telerik.Reporting.Services.WebApi.ReportsControllerBase.RegisterClient()\r\n  
    at lambda_method(Closure , Object , Object[] )\r\n  
    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)\r\n  
    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n  
    at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"} 

    Regards,
    Travis Lamkin
  5. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 11 Feb 2015 Link to this post

    Hi Travis,

    Please apply the following settings for all applications having a running Reporting REST service in them:
    1. If you use the ICache storage and the file system:
      • Make each application to write in its own folder. For the purpose you can use the CacheFactory.CreateFileCache Method (String), where the argument specifies the cache folder;
      • If users are authenticated, add additional separation in the cache storage by letting each user to use its own cache folder:
        protected override ICache CreateCache()
             {
                 var userID=GetUserID();
                 var appID=GetAppID();
         
                 return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache(String.Format("C:\\{0}\\{1}",appID,userID));
             }
        Note that the folders must have proper read/write access settings.
    2. If the applications are hosted in a web farm, you will have to switch to the IStorage storage - REST Service storage.

    I notice you have a support ticket on the same question. If you need further help, please update the ticket with further details how the applications are hosted and steps how to reproduce the problem locally.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Zach
    Zach avatar
    8 posts
    Member since:
    Mar 2014

    Posted 12 Mar 2015 in reply to Stef Link to this post

    Can you elaborate on what "folders must have proper read/write access settings" should be?  I've got a production site and a test site.  Prod works, UAT doesn't.  Both have the same permission settings but also use different app pools.  I was getting the original poster's error, but now I get "Access to the path '8.2.14.1204_ClientsCacheLock' is denied".  Here's my code used to create the file cache folder:

    protected override ICache CreateCache()
            {
                return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache(string.Format("{0}\\reportcache", HttpRuntime.AppDomainAppPath));
            }
  7. Zach
    Zach avatar
    8 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2015 Link to this post

    Sorry, the message I'm getting is "Access to the path '8.2.14.1204_LastCheckTimeLock' is denied".  And that error message is something I'm getting on the production site, which no changes have been made to.
  8. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 16 Mar 2015 Link to this post

    Hi Zach,

    Please check my response in your support ticket on the same question - #916058 'Access to the path is denied' Error on Production. Also please download and upgrade to the latest available internal build of Q3 2014 SP1 v8.2.14.1222 or Q1 2015 v9.0.15.313.

    I will appreciate it if we continue the discussion in the above mentioned support ticket.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  9. Zach
    Zach avatar
    8 posts
    Member since:
    Mar 2014

    Posted 16 Mar 2015 in reply to Stef Link to this post

    Upgrading to v9.0.15.225 resolved the issue for me.
  10. Alex Thomas
    Alex Thomas avatar
    1 posts
    Member since:
    Oct 2009

    Posted 06 Apr 2015 in reply to Zach Link to this post

    I get the error using the most recent version: 9.0.15.225.

    What is the root cause of this issue?

    Internal Server Error:
    An error has occurred.
    Access to the path '9.0.15.225_LastCheckTimeLock' is denied.

     

     Thanks..

  11. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 07 Apr 2015 Link to this post

    Hi everyone,

    We recently investigated the issue further and added some improvements in Telerik Reporting Q1 2015 SP1 v9.0.15.324. If upgrading projects to this version does not resolve the problem with the locked cache files, please check the following details.


    If the application is not hosted in a web farm use an ICache implementation in the service's CreateCache method, where each application (hosted on the same machine and having a Reporting REST service)  uses the same application pool. With this approach, different applications will not lock each other on accessing their cache storage, and will wait for each other.
    On the question Why?, ICache interface does not give application lock mechanism so that the access to the cache can be serialized. So if you are using ICache to store the viewer state, the service engine uses internally named semaphores in order to serialize the access to each particular entry. However it appears that trying to create semaphore with the same name from two different user contexts leads to an error in the OS.

    This will be addressed from our Dev team by introducing the possibility to specify different prefix for the cache keys for the different apps you deploy. Until the improvement is added, processes must be identified as the same user (by using the same application pool).


    The recommended option however is to provide IStorage implementation to your service controller (service's CreateStorage method) which provides native implementation of the lock mechanism for that particular storage. In the current case please use the MsSqlServerStorage IStorage implementation which uses db transactions with appropriate isolation level to implement locking mechanism. Additionally you may configure different databases for each different application.



    I hope this information helps you to resolve the issue.

    Regards,
    Stef
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  12. Zach
    Zach avatar
    8 posts
    Member since:
    Mar 2014

    Posted 08 Apr 2015 in reply to Stef Link to this post

    The issue resurfaced for me and after I upgraded to v9.0.15.324 and specify a static path for the ICache, I get the error "Access to the port is denied".
  13. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 09 Apr 2015 Link to this post

    Hi Zach,

    Please go through my previous post in the thread, and check if at the same time there are running other applications having a Reporting REST service with ICache implementation. Unless all running applications are identified as the same user on the machine, the cache might be locked. Thus test switching to an IStorage implementation (MsSqlServerStorage is recommended).

    Currently our developers are adding an improvement to allow multiple applications with Reporting REST service having ICache to run simultaneously on the same machine.

    Regards,
    Stef
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  14. Albert Brynjar
    Albert Brynjar avatar
    2 posts
    Member since:
    Jan 2015

    Posted 28 May 2015 in reply to Stef Link to this post

    Hi Stef

    On load or refresh, I always get the error:

    Internal Server Error:
    An error has occurred.
    Access to the port is denied

     

    However if I press F5, then everything works fine !!

    My code is like this:

    string cachePath = String.Format(@"E:\RAS\ReportCaching" + "/{0}", WindowsIdentity.GetCurrent().Name);
    var cache2 = Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache(cachePath);

    if (cache2.HasValue(cachePath))
    {
    cache2.Clear();
    }

    return Telerik.Reporting.Services.Engine.StorageFactory.CreateStorage(cache2);

     

    I hope you have a solution for me.

    Best regards:

    Albert Elísson

  15. Albert Brynjar
    Albert Brynjar avatar
    2 posts
    Member since:
    Jan 2015

    Posted 28 May 2015 in reply to Albert Brynjar Link to this post

    I have tried to change my code in the controller and use the DataBaseCache like so:

    protected override ICache CreateCache()
    {
          return Telerik.Reporting.Services.Engine.CacheFactory.CreateDatabaseCache("MsSql", "data source=xxxxxx;initial     catalog=xxxxxx;User ID=xxxxx;Password=xxxxxxx;");
    }

     I get caching rows in my db but....

    I get the same error on the server.

    This is so strange. Everything works like a charm on my local machine but when I run the web after deployment to

    the server, I get this strange behavior.

    That is, when I load the report up, I get the error "Access to the port is denied". I get the same error if I press the

    refresh button on the ReportViewer but everything works fine if I press F5 on my keyboard !!!!

     

    My application is a Asp.Net MVC application and I am using telerikReportViewer-9.0.15.324.

    What could be the cause of this? Some settings on the web server? It is Windows Server 2008 R2.

     

    I can't find any solution for this !!!! Please help...

    Best regards,

    Albert Elísson

     

  16. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 01 Jun 2015 Link to this post

    Hi Albert,

    Please download and install the latest available internal build v9.0.15.422 (this is a consecutive build of v9.0.15.324 which includes improvements in the Reporting REST service's cache management).

    After installing v9.0.15.422 apply the following cache settings depending on the type of hosting:
    1. If the application is hosted on a single instance as in development environment, you can use an ICache implementation like:
        protected override Telerik.Reporting.Cache.Interfaces.ICache CreateCache()
              {
                  return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
              }
       
      or
       
       protected override Telerik.Reporting.Cache.Interfaces.ICache CreateCache()
              {
                  return Telerik.Reporting.Services.Engine.CacheFactory.CreateDatabaseCache("mssql","connection string to the configured database");
              }
    2. If the application is hosted on multiple instances (web farm) suitable for production purpoces, you will need to use an IStorage implementation like:
      protected override Telerik.Reporting.Cache.Interfaces.IStorage CreateStorage()
             {
                 return new Telerik.Reporting.Cache.MsSqlServerStorage("connectionString string here");
             }
    For more details, check REST Service Storage.


    Regards,
    Stef
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  17. Timothy William
    Timothy William avatar
    1 posts
    Member since:
    Aug 2012

    Posted 01 Jun 2015 in reply to Stef Link to this post

    Hi Stef

    Thank you so much. My problem is resolved !!

    I downloaded version v9.0.15.422 like you suggested, used the upgrade wizard to update my project and changed the code in my ReportController to use the MsSqlServerStorage option like shown in option 2 and everything is working now. :)

    Best regards,

    Albert Elísson

Back to Top
DevCraft banner