Hi again,
I could get the problem again, and it seems that it happened due to an
OutOfMemoryError. The stack is this:
org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.IOException: Map
failed"; "split:nioMapped:/opt/jboss-5.0.1.GA/server/outsystems/data/
h2/localDB.h2.db"; SQL statement:
INSERT INTO JBM_MSG_CJQ (MESSAGE_ID, RELIABLE, EXPIRATION, TIMESTAMP,
PRIORITY, TYPE, HEADERS, PAYLOAD) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
[90031-140]
at
org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
at org.h2.message.DbException.get(DbException.java:156)
at
org.h2.message.DbException.convertIOException(DbException.java:313)
at org.h2.store.FileStore.setLength(FileStore.java:397)
at org.h2.store.PageStore.increaseFileSize(PageStore.java:
1020)
at org.h2.store.PageStore.increaseFileSize(PageStore.java:
1011)
at org.h2.store.PageStore.allocatePage(PageStore.java:996)
at org.h2.store.PageStore.allocatePages(PageStore.java:965)
at org.h2.store.PageOutputStream.reserve(PageOutputStream.java:
74)
at org.h2.store.PageOutputStream.write(PageOutputStream.java:
123)
at org.h2.store.PageLog.write(PageLog.java:498)
at org.h2.store.PageLog.logAddOrRemoveRow(PageLog.java:602)
at org.h2.store.PageStore.logAddOrRemoveRow(PageStore.java:
1235)
at org.h2.index.PageDataIndex.addTry(PageDataIndex.java:193)
at org.h2.index.PageDataIndex.add(PageDataIndex.java:124)
at org.h2.table.RegularTable.addRow(RegularTable.java:116)
at org.h2.command.dml.Insert.insertRows(Insert.java:120)
at org.h2.command.dml.Insert.update(Insert.java:82)
at
org.h2.command.CommandContainer.update(CommandContainer.java:70)
at org.h2.command.Command.executeUpdate(Command.java:199)
at
org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:
141)
at
org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:
127)
[...]
Caused by: java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:758)
at
org.h2.store.fs.FileObjectDiskMapped.reMap(FileObjectDiskMapped.java:
102)
at
org.h2.store.fs.FileObjectDiskMapped.setFileLength(FileObjectDiskMapped.java:
164)
at
org.h2.store.fs.FileObjectSplit.setFileLength(FileObjectSplit.java:90)
at org.h2.store.FileStore.setLength(FileStore.java:395)
... 111 more
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:755)
... 115 more
So the problem is that in org.h2.store.fs.FileObjectDiskMapped.reMap()
the line:
mapped = file.getChannel().map(mode, 0, length);
fails and mapped remains null, causing a lot of NullPointerExceptions
after that.
Maybe adding "if (mapping == null) reMap();" to readFully(), sync()
and write() methods is enough?
Thanks!
On Aug 24, 1:22 pm, Borja <[email protected]> wrote:
> Hi,
>
> We're using H2 (version 1.2.140) with connection string
> "jdbc:h2:split:nioMapped:/
> testDB;LOCK_MODE=3;CACHE_SIZE=262144;TRACE_LEVEL_FILE=0;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE"
> and we have a NullPointerException with this stack:
>
> 2010-08-06 10:34:25,895 WARN
> [org.jboss.messaging.core.impl.JDBCSupport] (http-0.0.0.0-8080-5)
> SQLException caught, SQLState HY000 code:50000- assuming deadlock
> detected, try:9
> org.h2.jdbc.JdbcSQLException: General error:
> "java.lang.NullPointerException"; SQL statement:
> INSERT INTO JBM_MSG_REF_CJQ (CHANNEL_ID, MESSAGE_ID, TRANSACTION_ID,
> STATE, ORD, PAGE_ORD, DELIVERY_COUNT, SCHED_DELIVERY) VALUES
> (?, ?, ?, ?, ?, ?, ?, ?) [50000-140]
> at
> org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
> at org.h2.message.DbException.get(DbException.java:156)
> at org.h2.message.DbException.convert(DbException.java:279)
> at org.h2.table.RegularTable.addRow(RegularTable.java:134)
> at org.h2.command.dml.Insert.insertRows(Insert.java:120)
> at org.h2.command.dml.Insert.update(Insert.java:82)
> at
> org.h2.command.CommandContainer.update(CommandContainer.java:70)
> at org.h2.command.Command.executeUpdate(Command.java:199)
> at
> org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:
> 141)
> at
> org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:
> 127)
> [...]
> Caused by: java.lang.NullPointerException
> at
> org.h2.store.fs.FileObjectDiskMapped.readFully(FileObjectDiskMapped.java:
> 140)
> at org.h2.store.fs.FileObjectSplit.read(FileObjectSplit.java:
> 52)
> at
> org.h2.store.fs.FileObjectSplit.readFully(FileObjectSplit.java:59)
> at org.h2.store.FileStore.readFully(FileStore.java:281)
> at org.h2.store.PageStore.readPage(PageStore.java:1097)
> at org.h2.store.PageStore.getPage(PageStore.java:561)
> at org.h2.store.PageStore.getFreeList(PageStore.java:922)
> at org.h2.store.PageStore.allocatePage(PageStore.java:989)
> at org.h2.store.PageStore.allocatePage(PageStore.java:977)
> at org.h2.index.PageDataLeaf.split(PageDataLeaf.java:356)
> at org.h2.index.PageDataNode.addRowTry(PageDataNode.java:151)
> at org.h2.index.PageDataIndex.addTry(PageDataIndex.java:159)
> at org.h2.index.PageDataIndex.add(PageDataIndex.java:124)
> at org.h2.table.RegularTable.addRow(RegularTable.java:116)
>
> This happened only twice since we're using 1.2.140, so I couldn't get
> more info debugging (I'll try if I get this error again).
>
> I've been reading the code and I suppose that there's a problem in
> org.h2.store.fs.FileObjectSplit.getFileObject(), but I haven't found
> anything obvious. Hope you can help.
>
> Thanks!
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.