Reputation: 925
I have found a number of posts that talk about syncblk output that shows an even number for the MonitorHeld count and no owner thread. This has been explained as a quirk, the lock is in transition probably because the owner thread has failed so, there is no owner. The MonitorHeld count is incremented by 2 for each waiter and one for the owner so, an even number means you have waiters but no owner.
My syncblk shows an odd number for the MonitorHeld count yet, no owning thread. What does that indicate? Also, I have two different process dumps from two different instances that look like this so, it wasn't a case of capturing a dump at just the right time.
My syncblk output:
Index SyncBlock MonitorHeld Recursion Owning Thread Info SyncBlock Owner 164 000000000a4d2428 1 1 000000002e406d30 16ac 144 0000000012f107c0 System.Object 368 000000000a3eb378 1125 0 0000000000000000 none 00000000104b1a38 System.Object 401 000000000a4d2888 1 1 000000002e79cce0 21a0 123 00000000110b09b0 System.Object 505 000000000a516918 1 1 000000002e55ca70 95c 114 00000000110984f0 System.Object 563 0000000002ae7978 1 1 000000002e7e1910 2058 261 00000000127d0300 System.Object 678 0000000002ae7f18 3 1 000000000a462240 f44 156 0000000012a66a28 System.Object ----------------------------- Total 814 CCW 0 RCW 1 ComClassFactory 0 Free 142 Index SyncBlock MonitorHeld Recursion Owning Thread Info SyncBlock Owner 122 000000002e561d98 3 1 000000000a621400 1410 180 0000000012cfcf28 System.Object 164 000000000a4d2428 1 1 000000002e406d30 16ac 145 0000000012f107c0 System.Object 368 000000000a3eb378 951 0 0000000000000000 none 00000000104b1a38 System.Object 401 000000000a4d2888 1 1 000000002e79cce0 21a0 124 00000000110b09b0 System.Object 505 000000000a516918 1 1 000000002e55ca70 95c 115 00000000110984f0 System.Object 563 0000000002ae7978 1 1 000000002e7e1910 2058 263 00000000127d0300 System.Object ----------------------------- Total 814 CCW 0 RCW 20 ComClassFactory 0 Free 76
Upvotes: 2
Views: 712
Reputation: 3027
The lock is either in transition or orphaned. A SyncBlk is orphaned when the owning thread terminates without releasing it.
Upvotes: 2