I have got thread dump from jstack
.
It shows that two threads locked on same object locked <0x00000000c0313ce0>
.
Is it possible situation when jstack shows stack trace for first thread not for same moment in time, when it took stack trace for second thred?
Or what else can be cause of such lock situation?
"Thread-1" #44 prio=5 os_prio=0 tid=0x000000001c418800 nid=0x922c in Object.wait() [0x0000000018ffe000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at org.h2.mvstore.db.MVTable.doLock1(MVTable.java:242)
at org.h2.mvstore.db.MVTable.lock(MVTable.java:167)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.engine.Database.lockMeta(Database.java:896)
at org.h2.engine.Database.removeMeta(Database.java:919)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.table.Table.removeChildrenAndResources(Table.java:525)
at org.h2.mvstore.db.MVTable.removeChildrenAndResources(MVTable.java:799)
at org.h2.engine.Session.cleanTempTables(Session.java:830)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.engine.Session.close(Session.java:708)
at org.h2.engine.Database.closeAllSessionsException(Database.java:1186)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.engine.Database.close(Database.java:1224)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.engine.DatabaseCloser.run(DatabaseCloser.java:63)
"Resource Destroyer in BasicResourcePool.close()" #110 daemon prio=5 os_prio=0 tid=0x000000001c41a000 nid=0x2d44 in Object.wait() [0x000000001b6ae000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at org.h2.mvstore.db.MVTable.doLock1(MVTable.java:242)
at org.h2.mvstore.db.MVTable.lock(MVTable.java:167)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.engine.Database.lockMeta(Database.java:896)
at org.h2.engine.Database.removeMeta(Database.java:919)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.table.Table.removeChildrenAndResources(Table.java:525)
at org.h2.mvstore.db.MVTable.removeChildrenAndResources(MVTable.java:799)
at org.h2.engine.Session.cleanTempTables(Session.java:830)
- locked <0x00000000c0313ce0> (a org.h2.engine.Database)
at org.h2.engine.Session.close(Session.java:708)
at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:383)
- locked <0x00000000ede38ce0> (a org.h2.engine.Session)
- locked <0x00000000ede37708> (a org.h2.jdbc.JdbcConnection)
at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:642)
at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:255)
- locked <0x00000000ee186430> (a com.mchange.v2.c3p0.impl.NewPooledConnection)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:621)
- locked <0x00000000ee186490> (a java.lang.Object)
at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1065)
at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1090)
at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1051)
at com.mchange.v2.resourcepool.BasicResourcePool.access$100(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$5.run(BasicResourcePool.java:1305)
Those threads two do not have the object locked: They are both waiting in an o.wait()
call for the same object o
.
Remember, o.wait()
first releases the lock on object o
. Then it waits for some other thread to notify the object, and then in re-acquires the lock before returning to the caller.