0

Whenever someone tries to access my application, if more than one person is using it it starts to hang. I recreated the issue and ran DebugDiag memory check and get this warning.

Number of objects ready for finalization: 457779

It then tells me that the finalizer thread may be blocked.

As the number of finalizable objects is more than 0, please check the finalizer thread to see if it is blocked or active

Finalizer Thread
ntdll!NtWaitForSingleObject+14
KERNELBASE!WaitForSingleObjectEx+8f
clr!CLREventBase::WaitEx+17c
clr!CLREventBase::WaitEx+113
clr!CLREventBase::WaitEx+7c
clr!FinalizerThread::WaitForFinalizerEvent+44
clr!FinalizerThread::FinalizerThreadWorker+54
clr!Frame::Push+59
clr!FillInRegTypeMap+198
clr!FillInRegTypeMap+c1
[[DebuggerU2MCatchHandlerFrame]]
clr!FinalizerThread::FinalizerThreadStart+10a
clr!Thread::intermediateThreadProc+86
kernel32!BaseThreadInitThunk+14
ntdll!RtlUserThreadStart+21

Any idea what might be going on?

TheDizzle
  • 1,534
  • 5
  • 33
  • 76
  • 1
    Are multiple users accessing the same objects held in memory...? You may need some locks – Omar Himada Jan 02 '19 at 19:19
  • Do many of your types have finalizers? If so what are you doing in the finalizers? The stack above just shows that the thread is waiting. It isn't necessarily blocked. – Brian Rasmussen Jan 02 '19 at 19:19
  • Your finalizer thread looks fine, but that's a lot of finalizable objects, especially for a web application. Are you disposing everything properly? To investigate a hang, debugdiag isn't the best tool. Try attaching the Visual studio debugger and look at the "parallel stacks" window – Kevin Gosse Jan 02 '19 at 19:21
  • There are areas in the application where `GC.Collect()` is being used as well as Close/Dispose. – TheDizzle Jan 02 '19 at 19:42
  • Why are you calling GC.Collect() directly? That's almost always a [bad idea](https://stackoverflow.com/questions/118633/whats-so-wrong-about-using-gc-collect) – Fran Jan 02 '19 at 20:11
  • Added another error I found. Removed GC.Collect – TheDizzle Jan 02 '19 at 20:21
  • If you used DebugDiag, I assume you have a memory dump? If so, remember that you can open it directly in Visual Studio, then check the "Parallel Stacks" window I mentioned earlier – Kevin Gosse Jan 02 '19 at 20:45

0 Answers0