Skip to content

Very Long JIT Times During ETW Rundown #102858

@brianrob

Description

@brianrob

Description

When a process does ETW rundown, a substantial portion of the rundown operation involves iterating over all jitted methods in the process and emitting events that support symbol and source-line resolution.

In programs with lots of jitted methods, this process can take a long time - 10s of seconds or even minutes. During this process, it is not possible to jit any methods, because CodeHeapIterator acquires and holds m_CodeHeapCritSec for the lifetime of the iterator.

Historically, we saw this on only the largest of workloads, and were able to address one of the code paths that lead to contention on m_CodeHeapCritSec, which took some of the pressure off. Unfortunately, though, we're seeing it more and more now, and it can have a material impact on service availability.

In looking at the code, I see that m_CodeHeapCritSec is protecting a few different data structures and scenarios, but I think I can break it down into two categories:

  1. Creation and destruction of code heaps, as well as manipulation of the code heap list.
  2. Allocation and free of memory into a code heap.

I'm wondering if it might be possible to separate these two categories of operations into two separate locks. By doing so, we could continue to allow jitting of methods concurrent with iteration of methods, and only block when a new code heap is needed, or manipulation of the code heap list is required. My suspicion is that manipulation of the list is much less common than allocation/free of memory within the code heap, and so this would (ideally) significantly reduce the affect of rundown on the running process.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions