On 2013-12-13 17:38, Uli wrote:
> I managed to strip it down a bit more...
Thanks a lot for the test-case!
Unfortunately, it proves to me that our MULTI_THREADED=1 support is not at all safe.
For example, in the stacktrace below:
java.lang.RuntimeException: Undo entry not written
at org.h2.message.DbException.throwInternalError(DbException.java:231)
at org.h2.store.PageLog.addUndo(PageLog.java:495)
at org.h2.store.PageStore.update(PageStore.java:1061)
at org.h2.index.PageBtreeLeaf.remove(PageBtreeLeaf.java:239) // synched on PageStore
at org.h2.index.PageBtreeNode.remove(PageBtreeNode.java:332) // not safe
at org.h2.index.PageBtreeNode.remove(PageBtreeNode.java:332) // not safe
at org.h2.index.PageBtreeIndex.remove(PageBtreeIndex.java:239) // not safe
at org.h2.table.RegularTable.removeRow(RegularTable.java:376) // not safe
at org.h2.command.dml.Delete.update(Delete.java:94)
at org.h2.command.CommandContainer.update(CommandContainer.java:79)
at org.h2.command.Command.executeUpdate(Command.java:253) // synched on Session
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:181)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:156)
at org.h2.test.H2MultiThreadTest2$Deletor.run(H2MultiThreadTest2.java:100)
at java.lang.Thread.run(Thread.java:662)
The layers up to org.h2.command.CommandContainer are synchronized around the Session object.
And the layers from org.h2.store.PageStore down are synchronized around the PageStore object.
But the layers in between have no synchronization, but they are shared between multiple sessions.
I am afraid I have no idea how to fix this, and it looks like quite a big job.
Regards, Noel.