none
PreemptiveGC disabled - how to debug? RRS feed

  • Question

  • Good morning, folks.

    I'm building a multi-threaded server-side application in C# 3.5, running as a Windows Service, and lately I've been having strange hangs. Using WinDBG, I can see that every once in a while, a thread will be marked as PreemptiveGC Disabled, and from that moment on everything grinds to a halt:

      43   1d  bd0 05bf8708   180b220 Disabled 00000000:00000000 00160070     2 MTA (GC) (Threadpool Worker)

    This basically happens a lot - threads disable and reenable preemptive GC all the time (I'm guessing this is because I'm calling into COM+ or other unmanaged code), but at some point a thread seems to be 'stuck' with disabled preemptive GC, and since it's a threadpool thread it lives on and never gets released, and after a while the GC seems to be unable to function. This, at least, is my analysis of the situation.

    My code involves alot of memory allocations, many gigabytes of strings and small objects constantly created and released, and after a while with no GC there simply is no more memory for the other threads, and they start throwing OutOfMemoryExceptions.

    I've been trying to follow tricks in Tess Fernandez's blog, especially to put an breakpoint on the unmanaged mscorwks!Thread::RareDisablePreemptiveGC method, but have not been successfull (I get a "Couldn't resolve error in mscorwks!Thread::RareDisablePreemptiveGC" when I try).

    So, has anyone ran into similar problems? Can anyone tell me if my approach is off-base and I should look elsewhere for the solution? Or, better yet, some solid SOS tips I can try to fine-tune my problem?

    Thanks,
       Avner Kashtan
    Sunday, December 21, 2008 10:32 AM

Answers