Multiple Java threads seemingly locking same monitor?

前端 未结 4 1214
情歌与酒
情歌与酒 2021-02-05 23:32

In a Java threaddump I found the following:

\"TP-Processor184\" daemon prio=10 tid=0x00007f2a7c056800 nid=0x47e7 waiting for monitor entry [0x00007f2a21278000]
          


        
4条回答
  •  执笔经年
    2021-02-05 23:49

    "http-0.0.0.0-8080-96" daemon prio=10 tid=0x00002abc000a8800 nid=0x3bc4 waiting for monitor entry [0x0000000050823000]
        java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:195)
        - locked <0x00002aadae12c048> (a java.util.WeakHashMap)
    
    "http-0.0.0.0-8080-289" daemon prio=10 tid=0x00002abc00376800 nid=0x2688 waiting for monitor entry [0x000000005c8e3000]
        java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:195)
        - locked <0x00002aadae12c048> (a java.util.WeakHashMap
    
    "http-0.0.0.0-8080-295" daemon prio=10 tid=0x00002abc00382800 nid=0x268e runnable [0x000000005cee9000]
         java.lang.Thread.State: RUNNABLE
         at org.apache.lucene.search.FieldCacheImpl$Cache.get(FieldCacheImpl.java:195)
         - locked <0x00002aadae12c048> (a java.util.WeakHashMap)
    

    In our thread dump, we have several threads lock same monitor, but only one thread is runnable. It probably because of lock competition, we have 284 other threads waiting for the lock. Multiple threads hold the same lock? said this only exists in the thread dump, for thread dump is not atomic operation.

提交回复
热议问题