Null Pointer Exception while executing a select

506 views
Skip to first unread message

Rajesh

unread,
Apr 1, 2011, 2:43:27 PM4/1/11
to H2 Database, itsp...@gmail.com
Hi,

We have been using H2 under very heavy loads (in the order of half a
million queries in a span of an hour) and are very happy with its
flexibility and performance.

Recently we saw a NPE being thrown from H2. Our logs were filled with
NPEs and looked like all the queries failed. However, on restarting
the JVM, which in turn initiates a new DataSource and connection with
DB seems to correct the issue and everything is back in order now.

Not sure if this is some sort of a bug or if we need to something
else. Any pointers on how to find out the root cause of this issue
will be really helpful.

TIA,
Rajesh


Details

H2 Version: h2-1.2.136.jar
Mode: Embedded
OS: Linux
JVM: 1.6.0_19 (32 Bit)
DB URL: jdbc:h2:db/
cruise;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE;DATABASE_EVENT_LISTENER='foo'


Trace:

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/thoughtworks/cruise/server/dao/maps/
Stage.xml.
--- The error occurred while applying a parameter map.
--- Check the allPassedStagesAfter-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: org.h2.jdbc.JdbcSQLException: General error:
"java.lang.NullPointerException" [50000-136]
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:
118)
at org.springframework.orm.ibatis.SqlMapClientTemplate
$3.doInSqlMapClient(SqlMapClientTemplate.java:298)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:
209)
... 18 more
Caused by: org.h2.jdbc.JdbcSQLException: General error:
"java.lang.NullPointerException" [50000-136]
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.message.DbException.toSQLException(DbException.java:
252)
at org.h2.message.TraceObject.logAndConvert(TraceObject.java:
387)
at
org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:
190)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:
172)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:
172)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:
185)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:
221)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:
189)
... 24 more
Caused by: java.lang.NullPointerException
at org.h2.index.PageBtreeIndex.writeRow(PageBtreeIndex.java:
362)
at org.h2.index.PageBtreeLeaf.writeData(PageBtreeLeaf.java:
262)
at org.h2.index.PageBtreeLeaf.write(PageBtreeLeaf.java:239)
at org.h2.store.PageStore.writeBack(PageStore.java:775)
at org.h2.util.CacheLRU.removeOld(CacheLRU.java:179)
at org.h2.util.CacheLRU.removeOldIfRequired(CacheLRU.java:124)
at org.h2.util.CacheLRU.put(CacheLRU.java:102)
at org.h2.store.PageStore.getPage(PageStore.java:592)
at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:211)
at org.h2.index.PageDataNode.getRow(PageDataNode.java:281)
at org.h2.index.PageDataNode.getRow(PageDataNode.java:282)
at org.h2.index.PageDataIndex.getRow(PageDataIndex.java:387)
at org.h2.index.PageDataIndex.getRow(PageDataIndex.java:376)
at org.h2.table.RegularTable.getRow(RegularTable.java:104)
at org.h2.index.PageBtreeIndex.getRow(PageBtreeIndex.java:285)
at org.h2.index.PageBtreeCursor.get(PageBtreeCursor.java:45)
at org.h2.index.MultiVersionCursor.get(MultiVersionCursor.java:
81)
at org.h2.index.IndexCursor.get(IndexCursor.java:207)
at org.h2.table.TableFilter.getValue(TableFilter.java:662)
at
org.h2.expression.ExpressionColumn.getValue(ExpressionColumn.java:166)
at org.h2.expression.Comparison.getValue(Comparison.java:173)
at
org.h2.expression.ConditionAndOr.getValue(ConditionAndOr.java:83)
at
org.h2.expression.Expression.getBooleanValue(Expression.java:185)
at org.h2.table.TableFilter.isOk(TableFilter.java:332)
at org.h2.table.TableFilter.next(TableFilter.java:296)
at org.h2.command.dml.Select.queryFlat(Select.java:492)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:
579)
at org.h2.command.dml.Query.query(Query.java:233)
at org.h2.index.ViewIndex.find(ViewIndex.java:191)
at org.h2.index.IndexCursor.find(IndexCursor.java:136)
at org.h2.table.TableFilter.next(TableFilter.java:254)
at org.h2.command.dml.Select.queryFlat(Select.java:492)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:
579)
at org.h2.command.dml.Query.query(Query.java:233)
at
org.h2.index.IndexCondition.getCurrentResult(IndexCondition.java:156)
at org.h2.index.IndexCursor.find(IndexCursor.java:93)
at org.h2.table.TableFilter.next(TableFilter.java:254)
at org.h2.command.dml.Select.queryFlat(Select.java:492)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:
579)
at org.h2.command.dml.Query.query(Query.java:233)
at org.h2.command.CommandContainer.query(CommandContainer.java:
80)
at org.h2.command.Command.executeQuery(Command.java:132)
at
org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:
175)
... 29 more

Thomas Mueller

unread,
Apr 5, 2011, 1:40:34 AM4/5/11
to h2-da...@googlegroups.com, Rajesh, itsp...@gmail.com
Hi

Please note this issue is now tracked here:

http://code.google.com/p/h2database/issues/detail?id=307

Regards,
Thomas

> --
> You received this message because you are subscribed to the Google Groups "H2 Database" group.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to h2-database...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages