Recently I received a question about a failing Variations Create Hierarchies Job. No matter how often the Job was started, the variation hierarchy never got created.
Looking at the ULS log we noticed the following error:
VariationCreateHierarchies – Failed to process a work item. This work item will not be retried.
Error: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex)
at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.SPWeb.GetList(String strUrl)
at Microsoft.SharePoint.Publishing.CacheManager..ctor(SPSite site)
at Microsoft.SharePoint.Publishing.CacheManager.GetManager(SPSite site, Boolean useContextSite, Boolean allowContextSiteOptimization, Boolean refreshIfNoContext)
at MicrosoftSharePoint.Publishing.PublishingWeb.get_VariationLabelsListId()
at Microsoft.SharePoint.Publishing.Internal.CachedVariationSettings.GetVariationLabelsList(SPWeb rootWeb)
at Microsoft.SharePoint.Publishing.Internal.CachedVariationSettings.<.ctor>b__6(SPSite elevatedSite, SPWeb rootWeb, Boolean newUserToken)
at Microsoft.SharePoint.Publishing.CommonUtilities.<>c__DisplayClass9.<RunWithElevatedSiteAndWebEx>b__7(Boolean elevated)
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Publishing.Internal.CachedVariationSettings.<>c__DisplayClass1.<CreateVariationSettings>b__0()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Publishing.Internal.CachedVariationSettings.CreateVariationSettings(SPSite site, SPUrlZone zone, Boolean forceRefresh)
at Microsoft.SharePoint.Publishing.Internal.VariationsSpawnJobDefinitionBase.ProcessWorkItemCore(SPWorkItem workItem, WorkItemTimerJobState timerJobState)
at Microsoft.Office.Server.Utilities.TimerJobUtility.<>c__DisplayClass1.<ProcessWorkItem>b__0()
So we can see that the timerjob failed due to an Access denied.
Looking at the callstack in more details we can see that the Access denied actually happens when accessing the Variation Labels list through the CacheManager of the Object Cache.
at Microsoft.SharePoint.SPWeb.GetList(String strUrl)
at Microsoft.SharePoint.Publishing.CacheManager..ctor(SPSite site)
at Microsoft.SharePoint.Publishing.CacheManager.GetManager(SPSite site, Boolean useContextSite, Boolean allowContextSiteOptimization, Boolean refreshIfNoContext)
at MicrosoftSharePoint.Publishing.PublishingWeb.get_VariationLabelsListId()
So the Cache Manager does not have rights to Access the Variation Labels list.
That can happen if the Portal Super User and Portal Super Reader accounts are not correctly configured as outlined in the following article:
And indeed, adjusting these accounts solved the problem.