sagarswathi / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

Java Level Deadlock on Database & Session #325

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This ticket is similar to #315 which is already closed:
http://code.google.com/p/h2database/issues/detail?id=315

We don't use large object in our code. The problem is reproduced either with 
in-memory db and file-based.

Here is the thread dump snippet we have running our test (not pure H2):

Found one Java-level deadlock:
=============================
"H2 Log Writer GRIDGAIN_INDEXES":
  waiting to lock monitor 0x5a7d30d4 (object 0x1b15b3a0, a org.h2.engine.Database),
  which is held by "gridgain-#143%cache.GridCacheReduceQueryMultithreadedSelfTest2%"
"gridgain-#143%cache.GridCacheReduceQueryMultithreadedSelfTest2%":
  waiting to lock monitor 0x5a7d313c (object 0x1b318920, a org.h2.engine.Session),
  which is held by "gridgain-#190%cache.GridCacheReduceQueryMultithreadedSelfTest2%"
"gridgain-#190%cache.GridCacheReduceQueryMultithreadedSelfTest2%":
  waiting to lock monitor 0x5a7d30d4 (object 0x1b15b3a0, a org.h2.engine.Database),
  which is held by "gridgain-#143%cache.GridCacheReduceQueryMultithreadedSelfTest2%"

Java stack information for the threads listed above:
===================================================
"H2 Log Writer GRIDGAIN_INDEXES":
    at org.h2.engine.Database.flush(Database.java:1695)
    - waiting to lock <0x1b15b3a0> (a org.h2.engine.Database)
    at org.h2.store.WriterThread.run(WriterThread.java:85)
    at java.lang.Thread.run(Thread.java:619)
"gridgain-#143%cache.GridCacheReduceQueryMultithreadedSelfTest2%":
    at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:170)
    - waiting to lock <0x1b318920> (a org.h2.engine.Session)
    at org.h2.fulltext.FullText$FullTextTrigger.getWordIds(FullText.java:1024)
    at org.h2.fulltext.FullText$FullTextTrigger.insert(FullText.java:963)
    at org.h2.fulltext.FullText$FullTextTrigger.fire(FullText.java:929)
    at org.h2.schema.TriggerObject.fireRow(TriggerObject.java:203)
    at org.h2.table.Table.fireRow(Table.java:885)
    at org.h2.table.Table.fireAfterRow(Table.java:876)
    at org.h2.command.dml.Merge.merge(Merge.java:161)
    at org.h2.command.dml.Merge.update(Merge.java:104)
    at org.h2.command.CommandContainer.update(CommandContainer.java:71)
    at org.h2.command.Command.executeUpdate(Command.java:212)
    - locked <0x1b15b3a0> (a org.h2.engine.Database)
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143)
    - locked <0x053b22e0> (a org.h2.engine.Session)
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheQueryIndex.store(GridCacheQueryIndex.java:900)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheQueryManager.store(GridCacheQueryManager.java:153)
    at org.gridgain.grid.kernal.processors.cache.GridCacheMapEntry.updateIndex(GridCacheMapEntry.java:1714)
    - locked <0x053b2588> (a java.lang.Object)
    at org.gridgain.grid.kernal.processors.cache.GridCacheMapEntry.innerSet(GridCacheMapEntry.java:642)
    - locked <0x053b2588> (a java.lang.Object)
    at org.gridgain.grid.kernal.processors.cache.GridCacheTxLocalAdapter.userCommit(GridCacheTxLocalAdapter.java:516)
    at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxLocal.finish(GridDhtTxLocal.java:835)
    at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxLocal$4.apply(GridDhtTxLocal.java:1018)
    at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxLocal$4.apply(GridDhtTxLocal.java:1013)
    at org.gridgain.grid.util.future.GridFutureAdapter.notifyListener(GridFutureAdapter.java:391)
    at org.gridgain.grid.util.future.GridFutureAdapter.access$000(GridFutureAdapter.java:35)
    at org.gridgain.grid.util.future.GridFutureAdapter$1.run(GridFutureAdapter.java:319)
    at org.gridgain.grid.kernal.processors.closure.GridClosureProcessor$1.body(GridClosureProcessor.java:1164)
    at org.gridgain.grid.util.worker.GridWorker$1.run(GridWorker.java:145)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.gridgain.grid.util.worker.GridWorker.run(GridWorker.java:190)
    at org.gridgain.grid.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:64)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
"gridgain-#190%cache.GridCacheReduceQueryMultithreadedSelfTest2%":
    at org.h2.command.Command.executeQuery(Command.java:176)
    - waiting to lock <0x1b15b3a0> (a org.h2.engine.Database)
    at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:96)
    - locked <0x1b318920> (a org.h2.engine.Session)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheQueryIndex.querySql(GridCacheQueryIndex.java:1208)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheQueryManager.executeQuery(GridCacheQueryManager.java:261)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheQueryManager.runQuery(GridCacheQueryManager.java:364)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheDistributedQueryManager.processQueryRequest(GridCacheDistributedQueryManager.java:160)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheDistributedQueryManager.access$100(GridCacheDistributedQueryManager.java:37)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheDistributedQueryManager$2.apply(GridCacheDistributedQueryManager.java:82)
    at org.gridgain.grid.kernal.processors.cache.query.GridCacheDistributedQueryManager$2.apply(GridCacheDistributedQueryManager.java:80)
    at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.processUnordered(GridCacheIoManager.java:192)
    at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.access$400(GridCacheIoManager.java:36)
    at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:113)
    at org.gridgain.grid.kernal.managers.communication.GridIoManager$GridFilteredMessageListener.onMessage(GridIoManager.java:1758)
    at org.gridgain.grid.kernal.managers.communication.GridIoManager$9.run(GridIoManager.java:623)
    at org.gridgain.grid.kernal.managers.communication.GridIoManager$10.body(GridIoManager.java:636)
    at org.gridgain.grid.util.worker.GridWorker$1.run(GridWorker.java:145)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.gridgain.grid.util.worker.GridWorker.run(GridWorker.java:190)
    at org.gridgain.grid.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:64)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

Found 1 deadlock.

----

We will try to provide pure H2 code snippet shortly.

H2 versions: 1.3.56, 1.2.147
Urgent: yes

Original issue reported on code.google.com by renat.ak...@gmail.com on 24 Jun 2011 at 7:41

GoogleCodeExporter commented 8 years ago
It's related only with H2 full text search native support.

Original comment by renat.ak...@gmail.com on 27 Jun 2011 at 3:48

GoogleCodeExporter commented 8 years ago
I can reproduce the problem.

Original comment by thomas.t...@gmail.com on 17 Jul 2011 at 8:20

GoogleCodeExporter commented 8 years ago
Fixed in version 1.3.158

Original comment by thomas.t...@gmail.com on 17 Jul 2011 at 12:11