Archive

Archive for July, 2013

Replacing missing named caches to a SharePoint Distributed Cache cluster

July 30, 2013 4 comments

A couple of days ago, I started seeing a large number of trace messages being logged to the ULS logs on a SharePoint 2013 farm relating to the distributed cache that looked like those pasted below. These message would repeat with a searing frequency of almost every second. Needless to say, this looked very bad for the server from a performance perspective.

07/25/2013 11:08:18.29 w3wp.exe (0x31BC) 0x3358 SharePoint Foundation DistributedCache ah24w Unexpected Unexpected Exception in SPDistributedCachePointerWrapper::InitializeDataCacheFactory for usage 'DistributedLogonTokenCache' - Exception 'Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode(ERRCA009):SubStatus(ES0001):Cache referred to does not exist. Contact administrator or use the Cache administration tool to create a Cache. at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, RequestBody reqBody) at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCacheProperties(RequestBody request, IClientChannel channel) at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName) at Microsoft.SharePoint.DistributedCaching.SPDistributedCachePointerWrapper.InitializeDataCacheFactory()'. 238c329c-bfb9-f0d8-7a04-fe9ab695789e

07/25/2013 11:08:18.29 w3wp.exe (0x31BC) 0x3358 SharePoint Foundation DistributedCache air4g Monitorable Token Cache: Failed to initialize SPDistributedSecurityTokenCache Exception: 'Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:Cache referred to does not exist. Contact administrator or use the Cache administration tool to create a Cache. at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, RequestBody reqBody) at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCacheProperties(RequestBody request, IClientChannel channel) at Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName) at Microsoft.SharePoint.DistributedCaching.SPDistributedCachePointerWrapper.InitializeDataCacheFactory() at Microsoft.SharePoint.DistributedCaching.SPDistributedCache..ctor(String nam... 238c329c-bfb9-f0d8-7a04-fe9ab695789e

07/25/2013 11:08:18.29* w3wp.exe (0x31BC) 0x3358 SharePoint Foundation DistributedCache air4g Monitorable ...e, TimeSpan timeToLive, SPDistributedCacheContainerType containerType, Boolean encryptData) at Microsoft.SharePoint.IdentityModel.SPDistributedSecurityTokenCache..ctor(String name, TimeSpan timeToLive, SPDistributedCacheContainerType containerType, Boolean encrptyData, TimeSpan minimumTokenExpirationWindow) at Microsoft.SharePoint.IdentityModel.SPDistributedSecurityTokenCacheInitializer.Init(Object state)'. 238c329c-bfb9-f0d8-7a04-fe9ab695789e

The key message above was the highlighted portion. Effectively, it was telling me that the DistributedLogonTokenCache was missing. So to investigate, I did the following through the PowerShell console.

clip_image001

This was alarming because the DistributedLogonTokenCache was not the only one missing. There should have been a bunch of other named caches here that seem to have gone missing too. To be precise, there should have been the following 10 named cache containers.

  1. DistributedDefaultCache
  2. DistributedAccessCache
  3. DistributedActivityFeedCache
  4. DistributedBouncerCache
  5. DistributedLogonTokenCache
  6. DistributedServerToAppServerAccessTokenCache
  7. DistributedSearchCache
  8. DistributedSecurityTrimmingCache
  9. DistributedActivityFeedLMTCache
  10. DistributedViewStateCache

Why? Because those are the several cache container types available in SharePoint 2013 and one of each of those is created during SharePoint configuration (psconfig) unless you chose to run configuration with the “/skipRegisterAsDistributedCachehost” switch during SharePoint installation on the server(s) in question. In fact, you can get the list above by checking the possible values of the SPDistributedCacheContainerType enumeration.

So now all of these seemed to be gone and try as I may, I couldn’t find the reason they vanished. I wasn’t seeing any errors relating to any of the other cache containers – only the DistributedLogonTokenCache. Maybe there wasn’t any activity on the farm I was monitoring that used the other caches or maybe the components that used those caches weren’t so dependent on them. Or maybe they just didn’t log failures to access the cache. In any case, I needed to restore them. I knew I could create a new named cache container using the New-Cache cmdlet but what I really needed to know was what the name of the named cache was to be.

I looked at my VM with a still healthy cluster for the answer and found the following:

clip_image002

Apparently, it uses the format SPDistributedCacheContainerType_FarmID to create the cache containers. Hoping that the whole setup was loosely coupled enough to allow the cache to be discoverable just through the naming convention, I tried the following command.

New-Cache -CacheName DistributedLogonTokenCache_<farmGUID>

Moments later, on checking the ULS logs again, the DistributedCache errors seemed to have ceased. This was good. I could now restore the other named cache containers in similar fashion. I still wish I knew what caused their mysterious disappearance but I am glad there is a way to get them back without complex wiring.

Advertisements
%d bloggers like this: