Query with thousands of logical operators and parameters causes 
StackOverflowError and then  ERROR 40XT0: An internal error was identified by 
RawStore module on next statement
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

         Key: DERBY-759
         URL: http://issues.apache.org/jira/browse/DERBY-759
     Project: Derby
        Type: Bug
  Components: SQL  
    Versions: 10.2.0.0    
    Reporter: Kathey Marsden


An SQL Statement with thousands of logical operators and parameters  causes a 
StackOverflow Error and then the next statement  throws a ERROR 40XT0: An 
internal error was identified by RawStore module.

The statement is of the form  SELECT * FROM T0 WHERE  (si = ? AND si = ? ) OR 
(si = ? AND si = ? ) ... 

I came across this issue when looking at DERBY-739 and code generation issues 
for large queries, thus the very silly looking query. 

To reproduce, uncomment this line in the test lang/largeCodeGen.java
// testLogicalOperators(con, 10000);



FAILED QUERY: Logical operators with 10000 parameters. 
java.lang.StackOverflowError
FAILED QUERY: IN clause with 3300 parameters. ERROR 40XT0: An internal error 
was identified by RawStore module.
        at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:301)
        at 
org.apache.derby.impl.store.raw.xact.Xact.setActiveState(Xact.java:1770)
        at 
org.apache.derby.impl.store.raw.xact.Xact.openContainer(Xact.java:1271)
        at 
org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(OpenConglomerate.java:865)
        at org.apache.derby.impl.store.access.heap.Heap.open(Heap.java:614)
        at 
org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:478)
        at 
org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:1315)
        at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java:7251)
        at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1470)
        at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1380)
        at 
org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1460)
        at 
org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1412)
        at 
org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(FromBaseTable.java:2370)
        at 
org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java:2120)
        at 
org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:307)
        at 
org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:434)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:217)
        at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:158)
        at 
org.apache.derby.impl.sql.compile.ReadCursorNode.bind(ReadCursorNode.java:74)
        at 
org.apache.derby.impl.sql.compile.CursorNode.bind(CursorNode.java:250)
        at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:336)
        at org.apache.deERROR 40XT0: An internal error was identified by 
RawStore module.
        at 
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:301)
        at 
org.apache.derby.impl.store.raw.xact.Xact.setActiveState(Xact.java:1770)
        at 
org.apache.derby.impl.store.raw.xact.Xact.openContainer(Xact.java:1271)
        at 
org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(OpenConglomerate.java:865)
        at org.apache.derby.impl.store.access.heap.Heap.open(Heap.java:614)
        at 
org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:478)
        at 
org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(RAMTransaction.java:1315)
        at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(DataDictionaryImpl.java:7251)
        at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.locateSchemaRow(DataDictionaryImpl.java:1470)
        at 
org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(DataDictionaryImpl.java:1380)
        at 
org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1460)
        at 
org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(QueryTreeNode.java:1412)
        at 
org.apache.derby.impl.sql.compile.DDLStatementNode.getTableDescriptor(DDLStatementNode.java:263)
        at 
org.apache.derby.impl.sql.compile.DDLStatementNode.getTableDescriptor(DDLStatementNode.java:234)
        at 
org.apache.derby.impl.sql.compile.DropTableNode.bind(DropTableNode.java:114)
        at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:336)
        at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:110)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:704)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:533)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(EmbedStatement.java:158)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.createTestTable(Unknown
 Source)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.testUnions(Unknown
 Source)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.main(Unknown 
Source)
rby.impl.sql.GenericStatement.prepare(GenericStatement.java:110)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:704)
        at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:118)
        at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:82)
        at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:62)
        at 
org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Driver30.java:92)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:678)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:522)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.checkT0Query(Unknown
 Source)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.testInClause(Unknown
 Source)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.testInClause(Unknown
 Source)
        at 
org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen.main(Unknown 
Source)
Exception in thread "main" 

NOTE:
 I was actually able to connect to the database after the query failed despite 
the RawStore error so maybe the db is not corrupted but just the transaction 
state out of whack for the connection. This needs more investigation.  I am 
putting this as SQL for now, even though we don't have a stack trace for the 
StackOverflow.  This is just a guess at component.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to