none
Dead threads and C++ Threads and root cause RRS feed

  • Question

  • Hi,

    I am trying to find the root cause in the line of the code for a custom application. When I took the memory dump I found that there are 95 % dead threads and followed this process by suing !Threads -special command in windbg. I am having two issues while doing the investigation.

    1.I am unable to used dt mscorwks!Thread 0x00180c10 m_ExposedObject because it is showing error that symbol is missing for mscorwks. Even though I have added sympathy for the dll for both 64 bit and 86 bit it does not works. I tried using this command as well but it does not works .cordll -ve -u -l.

    2. I am trying to understand why dead threads happen and which code to attribute it. I could find the gcroot for thread address and found they are GEN 2 objects and have at least three references. Does that enough to say the continuous  memory spike?

    What is the easiest way to understand the c++ threads,CLR threads and OS threads.

    Regards

    Rajaniesh

     

    Thursday, April 5, 2018 5:02 AM

All replies

  • Hi,

    thanks for posting here.

    >>What is the easiest way to understand the c++ threads,CLR threads and OS threads.

    Management of all managed threads is done through the Thread class, including threads created by the common language runtime and those created outside the runtime that enter the managed environment to execute code. The runtime monitors all the threads in its process that have ever executed code within the managed execution environment.

    When an unmanaged thread enters the runtime through, for example, a COM callable wrapper, the system checks the thread-local store of that thread to look for an internal managed Thread object.

    The OS thread is represented by Win32_Thread class.

    Here is a document about managed and unmanaged class, it may could be help of you.

    https://docs.microsoft.com/en-us/dotnet/standard/threading/managed-and-unmanaged-threading-in-windows

    Best Regards,

    Baron Bi


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 9, 2018 8:36 AM
  • I am looking for the cause of dead threads in a .NEt application. Surpirsingly We have many dead threads in an application and it seems a memory leak but I am trying to find the root cause of the dead threads how they are created

    Regards
    Rajaniesh

    Friday, April 13, 2018 11:10 PM
  • Hi,

    >>I am looking for the cause of dead threads in a .NEt application. Surpirsingly We have many dead threads in an application and it seems a memory leak but I am trying to find the root cause of the dead threads how they are created

    Sorry for the late response.

    For this case, you could use !Thread command with Windbg debug tool to find the root cause of the dead threads.

    For more information, please refer to these documents below.

    https://blogs.msdn.microsoft.com/paullou/2011/06/29/dead-threads/

    https://blogs.msdn.microsoft.com/paullou/2011/06/28/debugging-managed-code-memory-leak-with-memory-dump-using-windbg/

    Hope this could be help of you.

    Best Regards,

    Baron Bi


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 25, 2018 8:32 AM
  • I already referred to the link given but it does not describe the root cause of these dead threads
    Wednesday, April 25, 2018 7:47 PM