C
C#4mo ago
rqmedes

Very long time performing StackTrace Calls

Using .NET 4.8 running on IIS I am seeing very long times for StackTrace calls such as GetFrames() with this taking from 100's of milliseconds to seconds each call for a subset of requests to our servers. This seems to also degrade overtime the longer the server is up as processes requests. StackTrace is instantiated to not capture source info. e.g StackTrace(false).GetFrames(); The servers are not overloaded from a CPU perspective never going above 20%. Memory is always saturated, with regular spike and drops of the LOH and GEN2 heaps at the time of the requests to the server however time in GC doesn't spike. This problem occurs when there is no load on a server a only single isolated request is sent. Other things of note: The application makes heavy usage of Dynamics with many of the method calls being dynamic via a service locator pattern and caches There is a large amount of generated code with Reflection.Emit. There is an excessive amount of Generics in the millions of types that via type specialization and the large number of methods will be generating lots of specific code. System.Reflection.Assembly.Load seems to be happening regularly in the same web calls and is also very very slow. Internally I believe I am might be seeing issues in JitManager::JitCodeToMethodInfo but cannot be sure. I cannot see anything specific in the stack traces in the problem calls. Any advice in what areas I should be further looking at would be appreciated.
3 Replies
rqmedes
rqmedes4mo ago
Interestingly I was wrong re the memory, the problem even occurs under very low memory usage as well
reflectronic
reflectronic3mo ago
hey, this is stil an issue for you, right?
rqmedes
rqmedes3mo ago
yes