How To Troubleshoot Distributed Cache Error In Sharepoint 2013?
Published by Jacob Martin on May 26, 2015
Is your SharePoint 2013 application is performing so poorly due to Distributed Cache error? Recently the reason behind this error is fetched that a bug in an AppFabric is the main reason for this error.
AppFabric is used to save different information in SharePoint 2013 installation but today users are facing problem with the Logon Token Cache (DistributedLogonTokenCache). If you have the above metioned issue then here is the solution for you.
What is the main issue?
When the client’s homepage was being loaded, it has been noticed that “401 – Not Authorized” errors occurring for simple things like CSS or JS files, often multiple times in each of the file before a successful request was made to retrieve it.
When the reason for this error is searched a large number of other errors in the “DistributedCache” category founded, theses errors are:
- Unexpected Exception in SPDistributedCachePointerWrapper::InitializeDataCacheFactory for usage ‘DistributedLogonTokenCache’ – Exception ‘Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:The request timed out.
- Unexpected error occurred in method ‘GetObject’, usage ‘Distributed Logon Token Cache’ – Exception ‘Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:The request timed out.
This actually happen because when a user successfully logs in to the application, a logon token is get saved in the Distributed Logon Token Cache, that allows it to easily checked for future authentication. A bud with AppFabric, don’t allow cache to remove out any old entries. So with every request and login cache just grows heavy. Sometime, it becomes so large that accessing that is too time taking. And when the request time to get a logon token exceeds so much, then the request is counted as authorized which explains the 401 errors. When SharePoint receives 401 errors, it is to re-authenticate the user.
How to fix this error?
As an offical solution you can update AppFabric on all servers and update the DistributedCacheService.exe.config configuration file on all servers to include the backgroundGC key.
It is important to place appSettings node in between the configSections and dataCachConfig elements. This update will fix the bug and enables garbage collection which allows AppFabric to delete old entries from the cache, and maintain its size, which in turn ensures that requests will finish within the limited time period.
After the updating each server, perform the following steps:
- On all affected servers restart the AppFabric Windows Service.
- Restart the Distributed Cache SharePoint Service on all affected servers.
- Run iisreset on all servers.
- If by updating AppFabric does not entirely stop Distributed Cache errors from appearing then you can update the timeout values for the Distributed Cache. If you don’t perform this updation step then it will not remove your time gap and cache will grow larger and Distributed Cache errors will return again.
While the Timeout properties are having higher priority, you may observe errors in ULS referencing buffer size or connection failures. In that case, it’s also important to increase the buffer size and max connections.
Once the updates to the Distributed Cache get over, reset the AppFabric Windows Service and Distributed Cache SharePoint Service on all affected servers.
The above given steps will make your SharePoint database error free, but if you are unable to get rid of error messages it means that sharepoint is having serious issue and you need to apply the professionally designed SharePoint repair tool. This tool is sable to fix all your issuer occurred in sharepoint 2013. It effectively scans the damaged database files and repairs it to recover inaccessible objects in MDF database files. With this tool user can also retrieve share point database like tables, indexes, documents, labels and stored procedures from inaccessible MDF files.
How To Troubleshoot Distributed Cache Error
- Firstly launch the SharePoint Recovery Tool you would find an interface. This interface screen displays two options to recover SharePoint data: ‘Complete Repair’ and ‘Document Recovery’ Select as per your requirement.
- If you choose ‘Complete Repair’, the screen will show the options for selecting and searching SQL Server (.MDF) files. Click on ‘Select File’ to select a SharePoint database for repair. If you do not know the actual path of the database which you want to repair, click on the ‘Search File’ to locate the MDF file in a specific drive. After selecting the desired file initiate the scanning process
- After finishing the scan, the software would generate a tree of all SharePoint database tables and will display it in the left pane. You can select the table in the tree and can have the entire preview in the right pane. Then Click on ‘Repair’ to begin repairing for the selected database.
- After clicking on ‘Repair’, this dialog box will appear. Specify the SQL Server name or Instance name and the desired destination path. Click on the ‘Browse’ option to choose the destination path. And select ‘OK’ button.
- Once this process gets completed, you would find a dialog box that displays this message ‘Recovered file saved at the desired location. This shows that Recovery Process has successfully completed’. And select ‘OK’ button.
- You would find another dialog box that asks whether you want to attach the repaired database to the web application. If you click on ‘Yes’ button, the above dialog box will be displayed. In the web application URL type, the name of the corrupt database and SQL Server Instance name. Then Select ‘OK’ button and proceed. When the process gets finished, you would be able to access the repaired database by opening the web application.