I have a C# application using UCMA (Unified Communications Managed API) 4.0 SDK. After some time of running (couple of days to weeks) the application starts to hit 100% usage. I took a dump and analyzed it in WinDbg for runaway threads and saw unmanaged threads that have a call stack that points to MFReadWrite (Media Foundation). I'm not sure how to find the root cause and fix the issue. I am stuck and would love to get some help.
Below is an analysis on 3 runaway threads. I have posted the callstack of thread 24. Threads 21, 24, and 25 are all stuck in the same loop.
0:000> !loadby sos clr
0:000> .time
Debug session time: Thu May 21 16:24:49.000 2015 (UTC - 4:00)
System Uptime: 6 days 7:38:14.864
Process Uptime: 6 days 7:34:24.000
Kernel time: 0 days 1:01:59.000
User time: 0 days 8:15:40.000
0:000> !runaway
User Mode Time
Thread Time
21:31b0 0 days 2:49:02.202
24:1044 0 days 0:41:31.164
25:4040 0 days 0:37:55.929
0:000> ~24s
ntdll!RtlLeaveCriticalSection+0x6:
000007f9`08fd1016 ff490c dec dword ptr [rcx+0Ch] ds:000000a1`4f683e54=00000001
0:024> kb
RetAddr : Args to Child : Call Site
000007f9`046c31c3 : 000000a1`4f683bc0 000000a1`4f683c10 00000000`00000000 00000000`0000364c : ntdll!RtlLeaveCriticalSection+0x6
000007f9`046c3249 : 000000a1`32c0bf40 000000a1`5d3ed730 000000a1`538e6530 000000a1`56f44770 : MFReadWrite!CMFTWrapperAsync::ProcessingLoop+0x1db
000007f8`dad2364b : 000000a1`32c0bf40 000000a1`538e6530 000000a1`538e6530 000000a1`5d3ed730 : MFReadWrite!CMFTWrapperAsync::ProcessingLoopAsyncCallback::Invoke+0xd
000007f9`08fdc935 : 000000a1`5d3ed680 000000a1`4cd93a10 00000000`00000000 00000000`00000000 : mfplat!GetThreadData+0x14f
000007f9`08fd7a62 : 000000a1`5de55f00 00000000`00000000 00000000`00000000 000000a1`00000000 : ntdll!TppWorkpExecuteCallback+0xe5
000007f9`08851842 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!TppWorkerThread+0x604
000007f9`0900f9d1 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0x1a
00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x1d