While investigating JDK-8320515 I noticed this inconsistency in the -Xlog:monitorinflation logging output:
[35.415s][trace][monitorinflation] Checking in_use_list:
[35.415s][trace][monitorinflation] count=4, max=4
[35.415s][trace][monitorinflation] in_use_count=4 equals ck_in_use_count=4
[35.415s][trace][monitorinflation] in_use_max=4 equals ck_in_use_max=4
[35.415s][trace][monitorinflation] No errors found in in_use_list checks.
[35.415s][trace][monitorinflation] In-use monitor info:
[35.415s][trace][monitorinflation] (B -> is_busy, H -> has hash code, L -> lock status)
[35.416s][trace][monitorinflation] monitor BHL object object type
[35.416s][trace][monitorinflation] ================== === ================== ==================
[35.416s][trace][monitorinflation] 0x00007efd38002190 000 0x000000041592bd78 CompleteExit$2
[35.416s][trace][monitorinflation] 0x00007efd380020a0 000 0x000000041592bbb0 CompleteExit$1
[35.416s][trace][monitorinflation] 0x00007efe08324bb0 010 0x000000041592a918 java.lang.Thread
[35.416s][trace][monitorinflation] 0x00007efd640010b0 100 0x0000000415909f38 java.lang.ref.NativeReferenceQueue$Lock (is_busy: waiters=1, contentions=0, owner=0x0000000000000000, cxq=0x0000000000000000, EntryList=0x0000000000000000)
[35.463s][info ][monitorinflation] Starting the final audit.
[35.463s][trace][monitorinflation] Checking in_use_list:
[35.463s][trace][monitorinflation] count=4, max=4
[35.463s][trace][monitorinflation] in_use_count=4 equals ck_in_use_count=4
[35.463s][trace][monitorinflation] in_use_max=4 equals ck_in_use_max=4
[35.463s][trace][monitorinflation] No errors found in in_use_list checks.
[35.463s][trace][monitorinflation] In-use monitor info:
[35.463s][trace][monitorinflation] (B -> is_busy, H -> has hash code, L -> lock status)
[35.463s][trace][monitorinflation] monitor BHL object object type
[35.463s][trace][monitorinflation] ================== === ================== ==================
[35.463s][trace][monitorinflation] 0x00007efd640010b0 100 0x0000000415909f38 java.lang.ref.NativeReferenceQueue$Lock (is_busy: waiters=1, contentions=0, owner=0x0000000000000000, cxq=0x0000000000000000, EntryList=0x0000000000000000)
Note that initially we have 4 in-use monitors and we list all 4 of them. But then some are released and we only list the remaining java.lang.ref.NativeReferenceQueue$Lock monitor, but the count still says 4.
[35.463s][trace][monitorinflation] count=4, max=4
[35.463s][trace][monitorinflation] in_use_count=4 equals ck_in_use_count=4