Freigeben über


Azure Deployment Aborted - DiagnosticMonitorConfiguration.OverallQuotaInMB

I ran into an interesting issue today while configuring custom log directory in Azure Diagnostics.  The role was aborting with the following code in OnStart method.

public override bool OnStart()
{
    // Get the default initial configuration for DiagnosticMonitor.
    DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();

// Create a new DirectoryConfiguration object.
    DirectoryConfiguration directoryConfiguration = new DirectoryConfiguration();

// Add the name for the blob container in Windows Azure storage.
    directoryConfiguration.Container = "wad-custom-logs";

// Add the directory size quota.
    directoryConfiguration.DirectoryQuotaInMB = 2048;

// Add the log path for the role using RoleEnvironment.GetLocalResource().
    directoryConfiguration.Path = RoleEnvironment.GetLocalResource("MyCustomLogs").RootPath;

// Add the directoryConfiguration to the Directories collection.
    diagnosticConfiguration.Directories.DataSources.Add(directoryConfiguration);

// Schedule a transfer period of 30 minutes.
    diagnosticConfiguration.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

// Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration);

return base.OnStart();
}

The code itself is pretty straight forward and you wouldn't expect any kind of failures in deployment. However, it failed. After several hours of troubleshooting, I thought of checking what would happen if I use development storage, so changed the DiagnosticMonitor.Start from DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration) to DiagnosticMonitor.Start(CloudStorageAccount.DevelopmentStorageAccount, diagnosticConfiguration)

 

The local deployment failed with the below exception:

System.ArgumentException was unhandled

  Message=OverallQuotaInMB is 4080MB but sum of requested sub-quotas is 5120MB.

Parameter name: initialConfiguration

  Source=Microsoft.WindowsAzure.Diagnostics

  ParamName=initialConfiguration

  StackTrace:

       at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.StartWithExplicitConfiguration(DiagnosticMonitorStartupInfo startupInfo, DiagnosticMonitorConfiguration initialConfiguration)

       at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(CloudStorageAccount storageAccount, DiagnosticMonitorConfiguration initialConfiguration)

       at WebRole1.WebRole.OnStart() in D:\VS Projects\Visual Studio 2010\Projects\CustomLogDiagnostics\WebRole1\WebRole.cs:line 64

       at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)

       at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRole(RoleType roleType)

       at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()

       at System.Threading.ExecutionContext.runTryCode(Object userData)

       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

It was a good breakthrough after several hours of troubleshooting. I then checked the documentation for OverAllQuotaInMB for diagnostic monitor and found it to be default value of 4GB as stated in the exception.

https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.diagnostics.diagnosticmonitorconfiguration.overallquotainmb.aspx

Looking at the exception, you would think I can increase the OverAllQuotaInMB for the diagnostic monitor and resolve the issue. However, that's not it. The catch is OverallQuotaInMB can only be set to a lower value but not higher. The actual solution lies in the service definition file under LocalResources section. Here's a service definition configuration that should work.

<LocalResources>

    <LocalStorage name="DiagnosticStore" sizeInMB="8192" cleanOnRoleRecycle="false"/>

    <LocalStorage name="MyCustomLogs" sizeInMB="2048" cleanOnRoleRecycle="false" />

</LocalResources>

Comments

  • Anonymous
    June 19, 2013
    I known thanks are kinda late, but your post helped me just today, so thank you :-)