Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinDbg/SOS: Explanation of !SyncBlk output

I am looking of a description of the output generated by the !SyncBlk command of SOS.

Particularly I found no useful explanation on the column "MonitorHeld". This column shows high values in a series of crash dumps.

Example:

0:000> !SyncBlk
Index         SyncBlock MonitorHeld Recursion Owning Thread Info          SyncBlock Owner
   44 0000000005a5c228            1         1 000000000e7a6740  2304 273   000000019f858cd0 System.Object
   48 000000000579bae8            1         1 000000000e7a72e0  2370 275   000000015f999900 System.Object
   52 000000000579b9c8            1         1 0000000011bbd3b0  1e98 295   00000000ff89fe08 System.Object
   54 000000000579b938            1         1 000000000e7a38c0  1be4 249   000000013f8aa888 System.Object
  108 0000000005a5bfe8            1         1 000000000e79f300  224c 242   00000000ff8a5828 System.Object
  110 0000000005a5c078            1         1 000000000e79ca50  2290 262   000000015f9a8020 System.Object
  112 0000000005a5c108            1         1 0000000011bb70e0  1d38 236   000000015f99e408 System.Object
  114 000000000579b620            1         1 0000000011bb93c0  1884 304   00000001bf974a90 System.Object
  124 0000000005a44d48            1         1 000000000e7a6170  2300 272   000000019f853fe8 System.Object
  146 0000000005a44688           99         1 000000000588cbf0  13e0  38   000000017f71c4f8 System.Object
  155 0000000005a44f88            1         1 0000000011bba530  2274 301   000000019f82f120 System.Object
  157 0000000005a45018            1         1 0000000011bbf0c0  2034 290   000000015f952980 System.Object

Can anyone explain the "99" in column "MonitorHeld"?

Has anyone a a link to a complete reference documentation of this command?

Thanks, Alex

like image 298
Alex Avatar asked Feb 04 '10 20:02

Alex


2 Answers

The MonitorHeld refers to how many monitors are held by that specific SyncBlk.

Each time you have contention on a lock, you'll have 1 owner held syncblk. Each waiter on a lock holds 2.

Your 99 means that you have one object "owning" the lock, and 49 objects waiting on the lock.

The best discussion and detailed explanation of !syncblk I've found is this one by Tess Ferrandez.

like image 134
Reed Copsey Avatar answered Nov 15 '22 23:11

Reed Copsey


In addition to what Reed mentioned, you can use the SOSEX.dll extension's !dlk command to check for deadlocks as well.

like image 29
Otávio Décio Avatar answered Nov 15 '22 23:11

Otávio Décio