db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag Wanvik <dag.wan...@oracle.com>
Subject Re: NPE
Date Mon, 10 Dec 2012 20:15:19 GMT

On 10.12.2012 19:21, Pavel Bortnovskiy wrote:
> I upgraded to 10.9.1.0 and rerun with debug libraries (please disregard my previous message).
>
> Mon Dec 10 13:19:44 EST 2012 Thread[DatabasePublisher[BOND_WRITER],5,main] (XID = 289),
(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(GenericScanController.java:1048)
>         at 

It looks like "container" is null, cf. the line 1048:

        case SCAN_HOLD_INIT:
***>         reusableRecordIdSequenceNumber =
                container.getReusableRecordIdSequenceNumber();

i.e. has been closed, cf the assignment just above:

        ContainerHandle container = open_conglom.reopen();

The call to reopen just returns null if OpenConglomerate has been closed
somehow.

Smells like a race condition of sorts, maybe some missing
synchronization in the Derby code.
If you are able to post a self contained repro program, although this
might be tricky if this is indeed a race, this would increase your
chances of having this fixed soon..

Thanks,
Dag


 In any case the NullPointerException shoudln't be seen by the
application code, so this is a bug.


> org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(GenericScanController.java:622)
>         at org.apache.derby.impl.store.access.heap.HeapScan.fetchNextGroup(HeapScan.java:322)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(BulkTableScanResultSet.java:353)
>         at org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCore(BulkTableScanResultSet.java:308)
>         at org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:261)
>         at org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(ScrollInsensitiveResultSet.java:801)
>         at org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(ScrollInsensitiveResultSet.java:518)
>         at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(BasicNoPutResultSetImpl.java:478)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(EmbedResultSet.java:432)
>         at org.apache.derby.impl.jdbc.EmbedResultSet.next(EmbedResultSet.java:376)
>         at QueryResults$1.hasNext(QueryResults.java:268)
>         at DatabasePublisher.process(DatabasePublisher.java:318)
>         at java.lang.Thread.run(Thread.java:662)
>
> -----Original Message-----
> From: Rick Hillegas [mailto:rick.hillegas@oracle.com]
> Sent: Monday, December 10, 2012 1:05 PM
> To: derby-user@db.apache.org
> Subject: Re: NPE
>
> Hi Pavel,
>
> Can you reproduce this problem with the debug version of Derby? That would give us line
numbers in the stack trace.
>
> Thanks,
> -Rick
>
> On 12/10/12 9:23 AM, Pavel Bortnovskiy wrote:
>> 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(Unknow
>> n Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(U
>> nknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCor
>> e(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowC
>> ore(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRo
>> wFromSource(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRo
>> wCore(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(U
>> nknown
>> 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(Unkno
>> wn
>> 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(Unk
>> nown
>> 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(Unkn
>> own
>> 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.wrapArgsForTransportA
>> crossDRDA(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(Unknow
>> n Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.BulkTableScanResultSet.reloadArray(U
>> nknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.BulkTableScanResultSet.getNextRowCor
>> e(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowC
>> ore(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRo
>> wFromSource(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRo
>> wCore(Unknown
>> Source)
>>
>> at
>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(U
>> nknown
>> 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.
>>
>
> 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.


Mime
View raw message