Hello:

While testing my application, which uses Derby in memory-only mode, I get NPE 
inside Derby under "mysterious" circumstances.
At this point, I can't even figure out what's triggering it and where this 
could happen, but let me preempt my troubleshooting with some stack traces. 
Perhaps someone, with good knowledge of Derby's code, may offer some 
explanation. Here are some stack traces:

Mon Dec 10 12:12:36 EST 2012 Thread[DatabasePublisher[WRITER],5,main] (XID = 
235), (SESSIONID = 5), (DATABASE = memory:test), (DRDAID = null), Failed 
Statement is: select * from READER
java.lang.NullPointerException
       at 
org.apache.derby.impl.store.access.conglomerate.GenericScanController.reopenAfterEndTransaction(Unknown
 Source)
       at 
org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(Unknown
 Source)
       at 
org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(Unknown Source)
       at 
org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(Unknown 
Source)
       at 
org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(Unknown 
Source)
       at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown
 Source)
       at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(Unknown
 Source)
       at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(Unknown
 Source)
       at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown 
Source)
       at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source)
       at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source)
       at QueryResults$1.hasNext(QueryResults.java:268)
       at DatabasePublisher.process(DatabasePublisher.java:318)
       at java.lang.Thread.run(Thread.java:662)

or

2012-12-10 12:12:36,537 [DatabasePublisher[WRITER]] ERROR QueryResults  - 
Unable to execute ResultSet.next() for Statement ""select * from READER" 
[DERBY]"
java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
       at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
       at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
       at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
Source)
       at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source)
       at 
org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(Unknown 
Source)
       at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source)
       at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source)
       at QueryResults$1.hasNext(QueryResults.java:268)
       at DatabasePublisher.process(DatabasePublisher.java:318)
       at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLException: Java exception: ': 
java.lang.NullPointerException'.
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
 Source)
       ... 14 more
Caused by: java.lang.NullPointerException
       at 
org.apache.derby.impl.store.access.conglomerate.GenericScanController.reopenAfterEndTransaction(Unknown
 Source)
       at 
org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(Unknown
 Source)
       at 
org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(Unknown Source)
       at 
org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(Unknown 
Source)
       at 
org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(Unknown 
Source)
       at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown
 Source)
       at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(Unknown
 Source)
       at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(Unknown
 Source)
       at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown 
Source)
       ... 6 more


One more thing I can share is that this seems to also be a timing problem - if 
the code is executed slowly, line-by-line in the debugger, then this problem 
doesn't occur. But if run at full speed, then these exceptions are thrown. The 
problem is not intermittent and easily reproduced 100% of the time on my end.

Any thoughts would be greatly appreciated.

Pavel.

Jefferies archives and monitors outgoing and incoming e-mail. The contents of 
this email, including any attachments, are confidential to the ordinary user of 
the email address to which it was addressed. If you are not the addressee of 
this email you may not copy, forward, disclose or otherwise use it or any part 
of it in any form whatsoever. This email may be produced at the request of 
regulators or in connection with civil litigation. Jefferies accepts no 
liability for any errors or omissions arising as a result of transmission. Use 
by other than intended recipients is prohibited. In the United Kingdom, 
Jefferies operates as Jefferies International Limited; registered in England: 
no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London 
EC4V 3BJ. Jefferies International Limited is authorised and regulated by the 
Financial Services Authority.

Reply via email to