Search code examples
asp.netasp.net-mvcsessionazureazure-caching

Why do my instances recycle when trying to store sessions in co-located Azure cache?


I run an ASP.Net MVC3 application and have followed this Windows Azure How-To on how to store my sessions in a co-located cache in Windows Azure.

I have installed the mentioned Nuget-package, and applied the necessary information to my web.config. The web role is setup to run 2 small instances, and use a 30% co-located cache.

When I deploy to Azure, my instances just recycle. Through a remote desktop connection to one of the instances, I have found these two events in the logs, that seem related:

The CacheStatusIndicator service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 1000 milliseconds: Restart the service.

The CacheService service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 60000 milliseconds: Restart the service.

However, I cannot find much information on that.

Does anyone have a clue what I might be missing here?


Solution

  • Now I spent my shared amount of time dealing with this, and finally it seems to be working. Not sure exactly what part solved the problem, but I'll wrap up the changes I made, in case someone else have the same issue at some point.

    1. While debugging this issue, I also updated my application from MVC3 to MVC4. Not sure if that has anything to do with solving this problem, but at least it is one of the changes I made.
    2. I noticed that another exception was thrown by the the IntelliTrace service, so I disabled that in the deployment and re-deployed the application (my guess is that this problem is what actually caused the instances to cycle.

    Response from Microsoft Support on this issue:

    I was troubleshooting your deployment with the issue and I got a memory dump from the CacheService.exe

    This was the exception being thrown

    CLR exception type: System.TypeInitializationException "The type initializer for 'Microsoft.ApplicationServer.Caching.AzureCommon.AzureUtility' threw an exception." ModLoad: 000007feea010000 000007feea0fa000
    D:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll * ERROR: Symbol file could not be found. Defaulted to export symbols for D:\windows\system32\KERNEL32.dll - ntdll!ZwWaitForMultipleObjects+0xa: 00000000`76f5739a c3
    ret

    The exceptions on this namespace can happen if:

    • You set the Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString setting on ServiceConfiguration to use the local storage emulator
    • On the web.config you have the identifier value of the <dataCacheClients> section not set to the correct role name
    • In some rare cases if you have the SDK 1.6 and 1.7 installed together this can cause some mixed up DLLs when project is being built.