db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-7023) Exception inserting (possibly due to integer overflow)
Date Tue, 04 Dec 2018 17:03:00 GMT

    [ https://issues.apache.org/jira/browse/DERBY-7023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16708993#comment-16708993
] 

Rick Hillegas commented on DERBY-7023:
--------------------------------------

Thanks for logging this bug. I am not an expert in the storage layer. However, if you bear
with me, I will try to gather enough information so that we can script a repro for this problem.
Then I will try to get the attention of storage experts who no longer actively contribute.
They may be able to coach us forward toward a fix.

We claim that the number of rows in a Derby table is unlimited. We also claim that row length
is unlimited. See http://db.apache.org/derby/docs/10.14/devguide/cdevdvlp40724.html.

As far as I can see, the first claim is false. That is because org.apache.derby.iapi.store.raw.RecordHandle.getPageNumber()
returns a long. So the number of pages is at most 2**64. I doubt that you have busted that
limit.

The limit you have busted looks more like some kind of page length restriction. Page contents
have been loaded into a stream which is backed by a byte array. Here we run up against the
max length of a Java array (2**31).

Can you share the following information:

* The table's row signature, i.e., the CREATE TABLE statement.

* The values of the following storage parameters: derby.storage.minimumRecordSize, derby.storage.pageCacheSize,
derby.storage.pageReservedSpace, and derby.storage.pageSize.

* The contents of derby.log. In particular, it would be good to know what statement raised
this error. You can amp up the diagnostics written to derby.log by booting your JVM with the
following system properties:

{noformat}
-Dderby.language.logStatementText=true
-Dderby.stream.error.logSeverityLevel=0 
{noformat}

Thanks,
-Rick


> Exception inserting (possibly due to integer overflow)
> ------------------------------------------------------
>
>                 Key: DERBY-7023
>                 URL: https://issues.apache.org/jira/browse/DERBY-7023
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.10.1.1
>            Reporter: Sean Bridges
>            Priority: Major
>             Fix For: 10.15.0.0
>
>
> We get an exception writing to derby,
>  
> {code:java}
> Caused by: java.sql.SQLException: An unexpected exception was thrown
> at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:101)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:148)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:349)
> at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:431)
> at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
> at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2400)
> at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:85)
> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1436)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1724)
> at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPreparedStatement.java:1379)
> at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
> at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
> ... 1 more
> Caused by: java.sql.SQLException: An unexpected exception was thrown
> at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
> at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:126)
> at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
> ... 14 more
> Caused by: java.sql.SQLException: Java exception: ': java.io.IOException'.
> at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
> at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:126)
> at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:148)
> at org.apache.derby.impl.jdbc.Util.javaException(Util.java:370)
> at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:436)
> at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:432)
> ... 11 more
> Caused by: java.io.IOException
> at org.apache.derby.iapi.services.io.CompressedNumber.writeInt(CompressedNumber.java:97)
> at org.apache.derby.impl.store.raw.data.StoredRecordHeader.write(StoredRecordHeader.java:457)
> at org.apache.derby.impl.store.raw.data.StoredPage.logRow(StoredPage.java:3861)
> at org.apache.derby.impl.store.raw.data.InsertOperation.writeOptionalDataToBuffer(InsertOperation.java:370)
> at org.apache.derby.impl.store.raw.data.InsertOperation.<init>(InsertOperation.java:115)
> at org.apache.derby.impl.store.raw.data.LoggableActions.actionInsert(LoggableActions.java:139)
> at org.apache.derby.impl.store.raw.data.BasePage.insertNoOverflow(BasePage.java:604)
> at org.apache.derby.impl.store.raw.data.BasePage.insertAtSlot(BasePage.java:525)
> at org.apache.derby.impl.store.raw.data.StoredPage.insertAtSlot(StoredPage.java:6833)
> at org.apache.derby.impl.store.access.btree.BTreeController.doIns(BTreeController.java:938)
> at org.apache.derby.impl.store.access.btree.BTreeController.insert(BTreeController.java:1372)
> at org.apache.derby.impl.store.access.btree.index.B2IController.insert(B2IController.java:210)
> at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(IndexChanger.java:440)
> at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(IndexChanger.java:383)
> at org.apache.derby.impl.sql.execute.IndexChanger.insert(IndexChanger.java:590)
> at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(IndexSetChanger.java:268)
> at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(RowChangerImpl.java:453)
> at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:1057)
> at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:518)
> at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:452)
> at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:333)
> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1344)
> ... 7 more{code}
>  
> I think this is due to an integer overflow. 
> Earlier StoredPage#readPageHeader is called, and nextId is set to -2147481666.  Before
this line in StoredPage#readPageHeader,
> {code:java}
> nextId = lrdi.nextInt();{code}
> lrdi.position = 16, and
> lrdi.pageData = (in hex)  007500000001000000017f41de880219800007be0000000000...
> I can't provide the entire data base, as it is confidential.
> This occurred with derby 10.10.1.0, but I can reproduce it with 10.14.1.0
> We do a lot of writes/deletes to this table, it's quite possible we've hit 2 billion
inserts/deletes.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message