You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my code I follow the instructions from the docs and create a session using this snippet:
varproviders=newList<EventPipeProvider>(){newEventPipeProvider("System.Runtime",EventLevel.Verbose,(long)ClrTraceEventParser.Keywords.None,newDictionary<string,string>(){{"EventCounterIntervalSec","1"}})};varclient=newDiagnosticsClient(processId);using(varsession=client.StartEventPipeSession(providers)){// ... more code}
In most of the cases this works, but sometimes it fails to connect to a process running on my machine (note: I verified that processId is always correct). The error message is:
EXCEPTION: System.TimeoutException: The operation has timed out.
at System.IO.Pipes.NamedPipeClientStream.ConnectInternal(Int32 timeout, CancellationToken cancellationToken, Int32 startTime)
at Microsoft.Diagnostics.NETCore.Client.IpcEndpointHelper.Connect(IpcEndpointConfig config, TimeSpan timeout)
at Microsoft.Diagnostics.NETCore.Client.PidIpcEndpoint.Connect(TimeSpan timeout)
at Microsoft.Diagnostics.NETCore.Client.IpcClient.SendMessageGetContinuation(IpcEndpoint endpoint, IpcMessage message)
at Microsoft.Diagnostics.NETCore.Client.EventPipeSession.Start(IpcEndpoint endpoint, EventPipeSessionConfiguration config)
at Microsoft.Diagnostics.NETCore.Client.DiagnosticsClient.StartEventPipeSession(IEnumerable`1 providers, Boolean requestRundown, Int32 circularBufferMB)
This seems to be a random issue, so I can't provide a code to reliably reproduce it. I noticed that it occurs while my CPU is heavily loaded. In my environment I try spawning ~20 .NET processes that bring CPU utilization to 90-99%.
Then sometimes I see that a call to StartEventPipeSession freezes and times out after a while.
I've also tried calling the function once again after the timeout, but the result is the same.
It looks like as if the process I want to connect to failed to initialize the Event Counters for whatever reason. Is it possible?
I saw the issue from time to time in the past, but now it became more problematic, as my IT system grew and I want to keep an eye on more processes.
Other information
My processes are launched using an .exe file that has the same name for all of the processes (i.e. each process uses a separate copy of the same binaries). Previously I used Performance Counters to track the stats of my processes and I remember that using the same name messes up with Performance Counters. Is it possible that it's causing problems here as well?
The text was updated successfully, but these errors were encountered:
One possible workaround might be to try modifying the default connect timeout (currently 30 seconds) though I am not confident that the problem could be eliminated using this solution (just the frequency reduced):
I confirm that I don't use DOTNET_DiagnosticPorts.
My machine is under very serious load and it's not uncommon that CPU utilization shows 100%, or something very close to this value.
I wonder if this is possible for a .NET process to 'decide' to skip initialization of the Event Counters in a situation of a very heavy load?
For now I switched to StartEventPipeSessionAsync and use a CancellationToken, which expires after 5 seconds. This won't solve the problem, but at least my system works in a normal way and the only drawback is that it fails to collect stats from the process.
Also collecting a dump of the target process at the point where we are timing out might shed light on why the diagnostics ipc thread is not responding. This would tell us if something is preventing the diagnostics IPC server from processing messages.
Do you have a quick tutorial on how to do this? Typically I deal with 'a bit' higher level programming than this ;).
Description
In my code I follow the instructions from the docs and create a session using this snippet:
In most of the cases this works, but sometimes it fails to connect to a process running on my machine (note: I verified that
processId
is always correct). The error message is:This seems to be a random issue, so I can't provide a code to reliably reproduce it. I noticed that it occurs while my CPU is heavily loaded. In my environment I try spawning ~20 .NET processes that bring CPU utilization to 90-99%.
Then sometimes I see that a call to
StartEventPipeSession
freezes and times out after a while.I've also tried calling the function once again after the timeout, but the result is the same.
It looks like as if the process I want to connect to failed to initialize the Event Counters for whatever reason. Is it possible?
Configuration
Regression?
I saw the issue from time to time in the past, but now it became more problematic, as my IT system grew and I want to keep an eye on more processes.
Other information
My processes are launched using an .exe file that has the same name for all of the processes (i.e. each process uses a separate copy of the same binaries). Previously I used Performance Counters to track the stats of my processes and I remember that using the same name messes up with Performance Counters. Is it possible that it's causing problems here as well?
The text was updated successfully, but these errors were encountered: