You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Richard N. Hillegas (Jira)" <ji...@apache.org> on 2021/04/16 18:45:00 UTC

[jira] [Commented] (DERBY-7114) class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey

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

Richard N. Hillegas commented on DERBY-7114:
--------------------------------------------

Thanks for the detailed stack trace. I am not an expert in this code. It looks like Derby has confused a PageKey with a ContainerKey while scanning a btree index. A PageKey contains a ContainerKey (along with a page number). A PageKey is definitely not a ContainerKey and I would expect a ClassCastException if Derby attempted this illegal operation.

This definitely looks like a Derby bug, but without a repro, I cannot speculate any further or offer any workaround. Maybe someone who knows more will weigh in.

> class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-7114
>                 URL: https://issues.apache.org/jira/browse/DERBY-7114
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.14.2.0
>         Environment: Java 8/11, Windows/macOS
>            Reporter: Sam Hutchins
>            Priority: Major
>
> Hi,
>  
> We're using the embedded driver, and we sometimes see this exception in the wild:
>  
> {code:java}
> java.lang.RuntimeException: java.sql.SQLException: Java exception: 'class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey (org.apache.derby.iapi.store.raw.PageKey and org.apache.derby.iapi.store.raw.ContainerKey are in unnamed module of loader 'app'): java.lang.ClassCastException'.java.lang.RuntimeException: java.sql.SQLException: Java exception: 'class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey (org.apache.derby.iapi.store.raw.PageKey and org.apache.derby.iapi.store.raw.ContainerKey are in unnamed module of loader 'app'): java.lang.ClassCastException'. at uk.co.screamingfrog.db.utils.DBHelpers.handleSQLException(SourceFile:68) ~[dbutils-1.0-SNAPSHOT.jar:?] at uk.co.screamingfrog.seospider.db.LinksTableOperations.a(SourceFile:341) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.db.LinksTableOperations.b(SourceFile:215) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.storage.db.k.c(SourceFile:82) ~[ScreamingFrogSEOSpider.jar:?] at java.util.HashMap.computeIfAbsent(Unknown Source) ~[?:?] at uk.co.screamingfrog.seospider.storage.db.k.b(SourceFile:76) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.storage.db.k.a(SourceFile:41) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.g.f.b(SourceFile:184) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.g.f.a(SourceFile:81) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.g.f.f(SourceFile:56) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.g.m.h_(SourceFile:58) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.h.d.c(SourceFile:22) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.seospider.h.e.c(SourceFile:66) ~[ScreamingFrogSEOSpider.jar:?] at seo.spider.spider.a.n(SourceFile:114) ~[ScreamingFrogSEOSpider.jar:?] at seo.spider.spider.a.k(SourceFile:91) ~[ScreamingFrogSEOSpider.jar:?] at uk.co.screamingfrog.utils.utils.PriorityRunnable.run(SourceFile:25) ~[utils-1.0-SNAPSHOT.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?] at java.lang.Thread.run(Unknown Source) [?:?]Caused by: java.sql.SQLException: Java exception: 'class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey (org.apache.derby.iapi.store.raw.PageKey and org.apache.derby.iapi.store.raw.ContainerKey are in unnamed module of loader 'app'): java.lang.ClassCastException'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source) ~[derby-10.14.2.0.jar:?] at uk.co.screamingfrog.seospider.db.LinksTableOperations.a(SourceFile:314) ~[ScreamingFrogSEOSpider.jar:?] ... 17 moreCaused by: org.apache.derby.iapi.error.StandardException: Java exception: 'class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey (org.apache.derby.iapi.store.raw.PageKey and org.apache.derby.iapi.store.raw.ContainerKey are in unnamed module of loader 'app'): java.lang.ClassCastException'. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source) ~[derby-10.14.2.0.jar:?] at uk.co.screamingfrog.seospider.db.LinksTableOperations.a(SourceFile:314) ~[ScreamingFrogSEOSpider.jar:?] ... 17 moreCaused by: java.lang.ClassCastException: class org.apache.derby.iapi.store.raw.PageKey cannot be cast to class org.apache.derby.iapi.store.raw.ContainerKey (org.apache.derby.iapi.store.raw.PageKey and org.apache.derby.iapi.store.raw.ContainerKey are in unnamed module of loader 'app') at org.apache.derby.impl.store.raw.data.FileContainer.setIdentity(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.services.cache.ConcurrentCache.find(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.raw.data.FileContainer.getUserPage(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.raw.data.FileContainer.getPage(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.raw.data.BaseContainerHandle.getPage(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.ControlRow.get(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.ControlRow.get(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BranchControlRow.getChildPageAtSlot(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BranchControlRow.search(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BranchControlRow.search(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BTreeScan.positionAtStartForForwardScan(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BTreeForwardScan.positionAtStartPosition(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.store.access.btree.BTreeScan.fetchNext(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.sql.execute.TableScanResultSet.loopControl(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.sql.execute.TableScanResultSet.getNextRowCore(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.sql.execute.IndexRowToBaseRowResultSet.getNextRowCore(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.sql.execute.NestedLoopJoinResultSet.getNextRowCore(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source) ~[derby-10.14.2.0.jar:?] at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source) ~[derby-10.14.2.0.jar:?] at uk.co.screamingfrog.seospider.db.LinksTableOperations.a(SourceFile:314) ~[ScreamingFrogSEOSpider.jar:?] ... 17 more {code}
>  
> We've seen it happen in 2 separate products, and with multiple paths in. I'm not sure how to reproduce it though, I'm afraid. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)