miercuri, 22 august 2012

Windbg: SOSEX: Two new commands to fight with deadlocks: !mlocks & !mwaits



  • !mlocks – Lists all managed locks and unmanaged CriticalSections, along with their owner thread ID.

  • Sample:

    0:000> !mlocks
    Examining SyncBlocks...
    Scanning for ReaderWriterLock instances...
    Scanning for holders of ReaderWriterLock locks...
    Scanning for ReaderWriterLockSlim instances...
    Scanning for holders of ReaderWriterLockSlim locks...
    Examining CriticalSections...

    ClrThread  DbgThread  OsThread    LockType    Lock              LockLevel
    ------------------------------------------------------------------------------
    0x243      88         0x1b4c      SyncBlock   000000000bb60408                
    0x1        0          0x50bc      thinlock    00000000106e17f8  (recursion:2)





  • !mwaits – Lists all waiting threads and, if it can be determined, the lock objects they are waiting on.

  • Sample:

    0:000> !mwaits
    Examining SyncBlocks...
    Scanning for ReaderWriterLock instances...
    Scanning for holders of ReaderWriterLock locks...
    Scanning for ReaderWriterLockSlim instances...
    Scanning for holders of ReaderWriterLockSlim locks...
    Examining CriticalSections...
    Scanning for threads waiting on SyncBlocks...
    *** WARNING: Unable to verify checksum for IxNetwork.Main.dll
    Scanning for threads waiting on ReaderWriterLock locks...
    *** WARNING: Unable to verify checksum for mscorlib.ni.dll
    *** WARNING: Unable to verify checksum for System.ni.dll
    *** WARNING: Unable to verify checksum for System.Management.ni.dll
    Scanning for threads waiting on ReaderWriterLocksSlim locks...
    Scanning for threads waiting on CriticalSections...
    *** WARNING: Unable to verify checksum for System.Core.ni.dll
    *** ERROR: Module load completed but symbols could not be loaded for System.Core.ni.dll
    *** WARNING: Unable to verify checksum for System.Windows.Forms.ni.dll
    *** WARNING: Unable to verify checksum for System.Runtime.Remoting.ni.dll
    Scanning threads for waits on unknown locks..


    ClrThread  DbgThread  OsThread    LockType    Lock              LockLevel
    ------------------------------------------------------------------------------
    0x1b2      81         0x31c       <Unknown>   0000000000000000                
    0x218      86         0x8dc       <Unknown>   0000000000000000                
             
    ...             
                  
    0x3b2      92         0x4a54      <Unknown>   0000000000000000                
    0x16       24         0x4c70      <Unknown>   0000000000000000                
    0x0        3          0x4d08      <Unknown>   0000000000000000                
    0xd        13         0x4e34      SyncBlock   000000000bb60408                
    0xb7       77         0x4fd4      <Unknown>   0000000000000000                
    0x3f       59         0x51b8      <Unknown>   0000000000000000                
    0x21a      87         0x51c0      <Unknown>   0000000000000000                
    0x40       58         0x524c      <Unknown>   0000000000000000                
    0x7        7          0x53d0      <Unknown>   0000000000000000                
    ....


    References:
    http://stevestechspot.com/

    Niciun comentariu:

    Trimiteți un comentariu