Sitecore azure can't start

431 Views Asked by At

We have problem with deploying sitecore application into Azure Environment. After updating Cloud Service it cannot start, providnig information: Unhandled Exception: Microsoft.ApplicationServer.Caching.DataCacheException. In WaIISHost process logs I'm finding such error:

    0 : [00003180:00000006, 2014/09/09 06:35:16.89, ERROR] Unhandled exception: IsTerminating 'True',  Message 'System.TimeoutException: We waited for 'Boolean <CreateSymbolicLink>b__1()' that didn't finish within 00:00:30. 
   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at Sitecore.Azure.Sys.Retryer.Do.Until(Func`1 predicate, TimeSpan timeout)
   at RoleRootConfigurator.CreateSymbolicLink(String relativePathToAppRoot, DirectoryInfo localResourceDir)
   at WebRole.RoleRootConfigurator.ConfigureSymbolicLinksForApproot(DirectoryInfo localResourceDir)
   at WebRole.OnStart()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
   at Sitecore.Azure.Sys.Retryer.Do.Until(Func`1 predicate, TimeSpan timeout)
   at WebRole.RoleRootConfigurator.CreateSymbolicLink(String relativePathToAppRoot, DirectoryInfo localResourceDir)
   at WebRole.RoleRootConfigurator.ConfigureSymbolicLinksForApproot(DirectoryInfo localResourceDir)
   at WebRole.OnStart()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()'

We have created our custom WebRole, based on code prepared by Sitecore Developers. Here is presented code responsible for crating symbolic links:

public void ConfigureSymbolicLinksForApproot(DirectoryInfo localResourceDir)
{
    if (RoleEnvironment.IsEmulated)
        return;
    Trace.TraceInformation(" -- Configure app root starting...");
    this.CreateSymbolicLink("temp", localResourceDir);
    this.CreateSymbolicLink("App_Data/debug", localResourceDir);
    this.CreateSymbolicLink("App_Data/diagnostics", localResourceDir);
    this.CreateSymbolicLink("App_Data/indexes", localResourceDir);
    this.CreateSymbolicLink("App_Data/logs", localResourceDir);
    this.CreateSymbolicLink("App_Data/packages", localResourceDir);
    this.CreateSymbolicLink("App_Data/viewstate", localResourceDir);
    this.CreateSymbolicLink("App_Data/MediaCache", localResourceDir);
    this.CreateSymbolicLink("App_Data/Submit_Queue", localResourceDir);
}

private void CreateSymbolicLink(string relativePathToAppRoot, DirectoryInfo localResourceDir)
{
    DirectoryInfo appRootDir = new DirectoryInfo(Path.Combine(this.AppRoot.FullName, relativePathToAppRoot));
    Do.ThisOnce((Action)(() => RmDir.RemoveDir(appRootDir))).Until((Func<bool>)(() => !Directory.Exists(appRootDir.FullName)));
    DirectoryInfo tempLocalResourceDir = new DirectoryInfo(Path.Combine(localResourceDir.FullName, relativePathToAppRoot));
    Do.ThisOnce(new Action(tempLocalResourceDir.CreateIfNotExists)).Until((Func<bool>)(() => Directory.Exists(tempLocalResourceDir.FullName)));
    Do.ThisOnce((Action)(() => MkLink.CreateLink(appRootDir, tempLocalResourceDir))).WithTracePing("Waiting for '{0}' to be created as symbolic link in app root", (object)appRootDir.FullName).Until((Func<bool>)(() => Directory.Exists(appRootDir.FullName)));
}

I've also found such informations in Event Viewer:

Faulting application name: CacheService.exe, version: 1.0.5137.0, time stamp: 0x52304f01
Faulting module name: KERNELBASE.dll, version: 6.2.9200.16864, time stamp: 0x531d34d8
Exception code: 0xe0434352
Fault offset: 0x0000000000047b8c
Faulting process id: 0x1e80
Faulting application start time: 0x01cfcc0ca7dac7a3
Faulting application path: F:\plugins\Caching\CacheService.exe
Faulting module path: D:\Windows\system32\KERNELBASE.dll
Report Id: ee6a3966-37ff-11e4-93f6-00155d67d4ca
Faulting package full name: 
Faulting package-relative application ID: 

and

Application: CacheService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: Microsoft.ApplicationServer.Caching.DataCacheException
Stack:
   at Microsoft.ApplicationServer.Caching.AzureCommon.AzureUtility.ProcessException(System.Exception)
   at Microsoft.ApplicationServer.Caching.Colocatedservice.CacheService.<OnStart>b__0(System.Object)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

Based on this I've tried to update Windows AzureCache libraries using nuget, provided by Sitecore or this placed in Azure SDK 2.2 folder, but nothing has changed. Any help will be gratefull.

1

There are 1 best solutions below

1
On BEST ANSWER

Jacbar.

Based on the initial exception, the deployment process failed during creating Windows Symbolic Links for the following directories:

  • \temp
  • \App_Data\debug
  • \App_Data\diagnostics
  • \App_Data\indexes
  • \App_Data\logs
  • \App_Data\packages
  • \App_Data\viewstate
  • \App_Data\MediaCache

Sitecore Azure uses this trick to avoid overflow of last disk (usually disk F:/) on a Virtual Machine that has a limited size of 1.5 GB (used to be 1GB). This disk is used to keep ASP.NET Web Application you deploy to PaaS.

As .NET Reflector shows to me, the Sitecore.Azure.Sys.Retryer.Do.Until(Func predicate) method uses hardcoded timeout that equals to 30 seconds. Looks like 30 seconds is not enough in your case to remove old directory under F:\approot (aka Website) folder, create a new directory in the Azure Local Storage Resources and link it using Symbolic Links.

I would recommend opening a support ticket with Sitecore Support to figure out the best way to address 30 seconds hardcoded value.

Best Wishes, Oleg