Emergency dumps do not appear

The code below creates a crash dump when I run it in the Azure development environment, but not when I deploy it in the cloud. I have:

  • Microsoft instructions (see below)
  • Checked credentials in Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString by downloading blob.
  • It was expected that it would collapse (about ten times).
  • He stopped the deployment and waited half an hour.

But I still can not find anything in the storage account. I am targeting .Net 4 using VS 2010 Pro SP1 and deploying it with embedded material. What am I doing wrong?

public override void Run() { throw new ApplicationException("bugger"); } public override bool OnStart() { ServicePointManager.DefaultConnectionLimit = 12; DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration(); string conn_str = RoleEnvironment.GetConfigurationSettingValue("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"); CloudStorageAccount account = CloudStorageAccount.Parse(conn_str); DiagnosticMonitor diagnosticMonitor = DiagnosticMonitor.Start(account, config); CrashDumps.EnableCollection(true); return base.OnStart(); } 

Here is my configuration:

 <?xml version="1.0" encoding="utf-8"?> <ServiceDefinition name="WindowsAzureProject1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"> <WorkerRole name="WorkerRole1"> <Imports> <Import moduleName="Diagnostics" /> </Imports> </WorkerRole> </ServiceDefinition> 

and

 <?xml version="1.0" encoding="utf-8"?> <ServiceConfiguration serviceName="WindowsAzureProject1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*"> <Role name="WorkerRole1"> <Instances count="1" /> <ConfigurationSettings> <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="AccountName=XXX;AccountKey=XXX;DefaultEndpointsProtocol=https" /> </ConfigurationSettings> </Role> </ServiceConfiguration> 

(My real project does create crash dumps, but I have problems analyzing them, so I'm trying to create a shortened example. When this works, I will see if its crash dumps are better.)

EDIT: Part of the solution is to add

 config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); 

which creates the blob-crumps-dumps blob container, but unfortunately it remains empty. Also see my question about what happens with diagnostic data when a role fails .

+1
source share
3 answers

Thread.Sleep (60000) added before throwing an exception. I think this is happening:

  • Exception thrown.
  • An emergency dump stored in the local storage "DiagnosticStore", which is apparently configured with cleanOnRoleRecycle set to false.
  • The virtual machine has been redesigned because the instance has died. This terminates the diagnostic manager, abort any ongoing downloads.
  • A new instance of the diagnostic manager starts. He begins to load the old dump.
  • Go to 1.
+1
source

I believe you are missing the RoleInstanceDiagnosticManager. Try to do this:

 DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration(); string conn_str = RoleEnvironment.GetConfigurationSettingValue("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"); CloudStorageAccount account = CloudStorageAccount.Parse(conn_str); RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = account.CreateRoleInstanceDiagnosticManager(RoleEnvironment.DeploymentId, RoleEnvironment.CurrentRoleInstance.Role.Name, RoleEnvironment.CurrentRoleInstance.Id); CrashDumps.EnableCollection(true); config.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory()); config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1); config.ConfigurationChangePollInterval = TimeSpan.FromMinutes(5); //set the configuration for use roleInstanceDiagnosticManager.SetCurrentConfiguration(config); RoleEnvironment.Changing += new EventHandler<RoleEnvironmentChangingEventArgs>(RoleEnvironment_Changing); return base.OnStart(); 
0
source

Is it possible that you did not install ScheduledTransferPeriod and LogLevelFilter?

 TimeSpan tsLogPeriod = TimeSpan.FromMinutes(double.Parse(RoleEnvironment.GetConfigurationSettingValue("LogIntervalInMinutes"))); DiagnosticMonitorConfiguration diagnosticMonitorConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration(); diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = tsLogPeriod; diagnosticMonitorConfiguration.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose; DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticMonitorConfiguration); } 
0
source

Source: https://habr.com/ru/post/886361/


All Articles