C# ';系统资源不足';当我在ServiceFabric群集上使用EventFlow侦听ETW事件时
我有一个ETW侦听器,它使用在服务结构上运行的EventFlow 这是我的配置文件(eventFlowConfig.json): 这是我的切入点:C# ';系统资源不足';当我在ServiceFabric群集上使用EventFlow侦听ETW事件时,c#,asp.net-core,azure-service-fabric,etw,event-flow,C#,Asp.net Core,Azure Service Fabric,Etw,Event Flow,我有一个ETW侦听器,它使用在服务结构上运行的EventFlow 这是我的配置文件(eventFlowConfig.json): 这是我的切入点: private static void Main() { try { string configurationFileName = "eventFlowConfig.json"; using (var diagnosticsPipeline = ServiceFabricDiagnosticPipel
private static void Main()
{
try
{
string configurationFileName = "eventFlowConfig.json";
using (var diagnosticsPipeline = ServiceFabricDiagnosticPipelineFactory.CreatePipeline("MyService", configurationFileName))
{
ServiceRuntime.RegisterServiceAsync("MyServiceType",
context => new Service(context)).GetAwaiter().GetResult();
ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(Service).Name);
// Prevents this host process from terminating so services keeps running.
Thread.Sleep(Timeout.Infinite);
}
}
catch (Exception e)
{
ServiceEventSource.Current.ServiceHostInitializationFailed(e.ToString());
throw;
}
}
当我在调试时在本地群集中多次启动/停止服务时,会出现以下异常:
System.Runtime.InteropServices.COMException: 'Insufficient system resources exist to complete the requested service. (Exception from HRESULT: 0x800705AA)'
在重新启动计算机之前,我无法重新启动服务。问题是我在本地环境以外的其他环境中也遇到了相同的异常
我尝试过这个::我的服务是无状态的,每个节点只有一个实例
该配置是否足以释放/重用ETW会话
"sessionNamePrefix": "MyListenerService",
"cleanupOldSessions": true,
"reuseExistingSession": true,
还有其他人遇到过这个问题吗
编辑
在@Diego Mendes的回答之后,我已经得到了这个执行logman-ets
...
EventFlow-EtwInput-a8aefb3c-594f-4ac7-b9d8-6da1791fb122 Trace Running
EventFlow-EtwInput-fe5f58e6-d1a7-4198-95b2-d343584cf46b Trace Running
EventFlow-EtwInput-33f67287-5563-4835-b3a1-5527e4fc5e5e Trace Running
EventFlow-EtwInput-959eef04-a5ae-47eb-9b7e-057a9fd3fb28 Trace Running
EventFlow-EtwInput-0095f186-d657-4974-a613-213d7eb49def Trace Running
EventFlow-EtwInput-8fbc52f5-2de6-4826-bce2-36d8abf0c264 Trace Running
EventFlow-EtwInput-8e654b40-c299-48f4-818e-5ebe3c2341a4 Trace Running
EventFlow-EtwInput-7ec63ec9-428b-4658-b059-698b5ae66986 Trace Running
EventFlow正在忽略mysessionNamePrefix
,并正在用EventFlow>Input覆盖它?可能是EventFlow的bug
我将尝试使用EventFlow-EtwInput
作为我的sessionnameffix
正如您所指出的,这是因为您多次启动和停止服务。每次启动服务时,都会创建一个新会话,当您在调试模式下执行此操作时,调试器会在关闭活动会话之前终止进程
从您链接的Matt答案:
Windows限制可以运行64个ETW会话
同时考虑使用一个运行在每个状态的无状态应用程序
节点创建单个会话
通过运行以下命令,可以检查何时再次发生,是否有任何会话保持打开状态:
logman-ets
...
EventFlow-EtwInput-a8aefb3c-594f-4ac7-b9d8-6da1791fb122 Trace Running
EventFlow-EtwInput-fe5f58e6-d1a7-4198-95b2-d343584cf46b Trace Running
EventFlow-EtwInput-33f67287-5563-4835-b3a1-5527e4fc5e5e Trace Running
EventFlow-EtwInput-959eef04-a5ae-47eb-9b7e-057a9fd3fb28 Trace Running
EventFlow-EtwInput-0095f186-d657-4974-a613-213d7eb49def Trace Running
EventFlow-EtwInput-8fbc52f5-2de6-4826-bce2-36d8abf0c264 Trace Running
EventFlow-EtwInput-8e654b40-c299-48f4-818e-5ebe3c2341a4 Trace Running
EventFlow-EtwInput-7ec63ec9-428b-4658-b059-698b5ae66986 Trace Running
它将列出所有活动会话,您的会话可能显示如下:
MyListenerService-A402EE30-53B7-48E4-B602-76B101C0AB97
如果有多个会话处于活动状态,是因为它没有正确关闭,也没有重用旧会话
在配置中,当您设置:
CleanuPaldSessions:如果设置为TRUE,则现有ETW跟踪会话
匹配sessionNamePrefix的将被关闭。这有助于收集
剩余会话实例,因为它们的数量有限制
重用现有会话:如果启用,则现有跟踪会话
将重复使用与sessionNamePrefix匹配的。如果清除旧会话
也将打开,然后它将保留一个会话以供重新使用
根据您的设置,您正在使用这两个选项,我将尝试调整这些值,看看是否可以解决问题。只是添加到这个答案中,因为我遇到了相同的错误
使用列出所有活动会话
logman-ets
对于所有活动会话,执行stop命令,如
记录员站“MyListenerService-A402EE30-53B7-48E4-B602-76B101C0AB97”-ets
它帮助我继续编写代码。我尝试了logman-ets命令
,并编辑了我的问题。EventFlow-EtwInput-*
可能是您以前的会话!尝试使用logman stop EventFlow-EtwInput-a8aefb3c-594f-4ac7-b9d8-6da1791fb122-ets关闭这些会话
再次启动应用程序并查看创建的名称。确保您使用的EventFlow包的版本是最新版本升级EventFlow.ServiceFabric和EventFlow.Inputs.ETW包问题已解决:)