Alp*_*a75 4 c# etw event-flow azure-service-fabric asp.net-core
我有一个使用在 Service Fabric 上运行的 EventFlow 的 ETW 侦听器。
这是我的配置文件(eventFlowConfig.json):
{
"inputs": [
{
"type": "ETW",
"sessionNamePrefix": "MyListenerService",
"cleanupOldSessions": true,
"reuseExistingSession": true,
"providers": [
{
"providerName": "Provider0"
}
]
}
],
"filters": [],
"outputs": [
{
"type": "CustomOutput"
}
],
"schemaVersion": "2018-04-04",
"extensions": [
{
"category": "outputFactory",
"type": "CustomOutput",
"qualifiedTypeName": "MyNamespace.EventFlow.Outputs.CustomOutputFactory, MyAssembly"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是我的切入点:
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;
}
}
Run Code Online (Sandbox Code Playgroud)
当我在调试时在本地集群中多次启动/停止服务时,我收到此异常:
System.Runtime.InteropServices.COMException: 'Insufficient system resources exist to complete the requested service. (Exception from HRESULT: 0x800705AA)'
Run Code Online (Sandbox Code Playgroud)
在重新启动计算机之前,我无法重新启动该服务。问题是我在本地以外的其他环境中也遇到了相同的异常。
我尝试过以下操作:ServiceFabric 应用程序中的 TraceEventSession 使用引发资源不足错误:我的服务是无状态的,并且只有一个节点实例。
此配置是否足以释放/重用 ETW 会话?
"sessionNamePrefix": "MyListenerService",
"cleanupOldSessions": true,
"reuseExistingSession": true,
Run Code Online (Sandbox Code Playgroud)
还有其他人遇到过这个问题吗?
编辑
@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
Run Code Online (Sandbox Code Playgroud)
EventFlow 忽略我的并用?sessionNamePrefix覆盖 EventFlow-EtwInput可能是 EventFlow 的错误吗?
我会尝试使用EventFlow-EtwInput作为我的sessionNamePrefix。
正如您所指出的,发生这种情况是因为您多次启动和停止服务。每次启动服务时,都会创建一个新会话,当您在调试模式下执行此操作时,调试器会在关闭活动会话之前终止该进程。
从马特的回答你链接:
Windows 限制可以同时运行 64 个 ETW 会话。考虑使用在每个节点上运行的单个无状态应用程序来创建单个会话。
您可以通过运行以下命令检查它何时再次发生,是否有任何会话保持打开状态:
logman -ets
它将列出所有活动会话,您的会话可能会显示为如下所示:
MyListenerService-A402EE30-53B7-48E4-B602-76B101C0AB97
如果您有多个活动会话,是因为它没有正确关闭,并且也没有重用旧会话。
在配置中,当您设置:
cleanupOldSessions:如果设置为 TRUE,则将关闭与 sessionNamePrefix 匹配的现有 ETW 跟踪会话。这有助于收集剩余的会话实例,因为它们的数量有限制。
useExistingSession:如果打开,则将重新使用与 sessionNamePrefix 匹配的现有跟踪会话。如果 cleanupOldSessions 也被打开,那么它将保留一个会话打开以供重复使用。
从您的设置来看,您正在使用两者,我会尝试调整这些值以查看是否可以解决问题。
| 归档时间: |
|
| 查看次数: |
4433 次 |
| 最近记录: |