Derby
  1. Derby
  2. DERBY-2783

corrupt metadata leads to null pointer exception when trying to build table descriptor.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.2.2.0
    • Fix Version/s: None
    • Component/s: SQL
    • Urgency:
      Normal

      Description

      While trying to data mine a corrupted database got null pointer exceptions followed by RawStore module error on all subsequent calls. I don't have the
      database so the following description is just a guess at what is happening based on the provided stack trace and looking at the code.

      My guess is that the metadata is corrupted in some way such that an index to base table lookup of the metadata does not find a row. This would lead to
      the code in DataDictionaryImpl.getDescriptorViaIndex() maybe getting no rows back from the call to:

      { base_row_exists = heapCC.fetch( baseRowLocation, outRow.getRowArray(), (FormatableBitSet ) null); }

      The current code does a bunch of checking in SANE code for base_row_exists, but does not check at all in insane code. The code should
      throw an exception if base_row_exists is false.

      What I think is happening is that code then try's to initialize the descriptor based on a row that never got read. This eventually lead to
      a call to create a UUID based on a string which is null, and StringReader x = new StringReader(null); results in a null pointer exception.

        Activity

        Hide
        Rick Hillegas added a comment -

        Triaged for 10.5.2: Assigned normal urgency.

        Show
        Rick Hillegas added a comment - Triaged for 10.5.2: Assigned normal urgency.
        Hide
        Mike Matrigali added a comment -

        The problem that led to this is that user database could not get booted due to a recovery error. See derby-user thread:
        http://www.nabble.com/java.sql.SQLException%3A-An-internal-error-was-identified-by-RawStore-module.-p11009927.html

        Show
        Mike Matrigali added a comment - The problem that led to this is that user database could not get booted due to a recovery error. See derby-user thread: http://www.nabble.com/java.sql.SQLException%3A-An-internal-error-was-identified-by-RawStore-module.-p11009927.html
        Hide
        Mike Matrigali added a comment -

        Here is the derby.log from the report of this issue in the derby-user list:
        ----------------------------------------------------------------
        2007-06-07 19:26:57.054 GMT:
        Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.2.0 - (485682): instance c013800d-0113-07a7-63b0-0000001e9dd8
        on database directory C:\workspace\SeedTrak2\Database\SeedTrakDB

        Database Class Loader started - derby.database.classpath=''
        2007-06-07 19:27:28.679 GMT Thread[main,6,main] (XID = 38), (SESSIONID = 0), (DATABASE = C:\workspace\SeedTrak2\Database\SeedTrakDB), (DRDAID = null), Cleanup action starting
        2007-06-07 19:27:28.679 GMT Thread[main,6,main] (XID = 38), (SESSIONID = 0), (DATABASE = C:\workspace\SeedTrak2\Database\SeedTrakDB), (DRDAID = null), Failed Statement is: select * from dealer
        java.lang.NullPointerException
        at java.io.StringReader.<init>(Unknown Source)
        at org.apache.derby.impl.services.uuid.BasicUUID.<init>(Unknown Source)
        at org.apache.derby.impl.services.uuid.BasicUUIDFactory.recreateUUID(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SYSCONGLOMERATESRowFactory.buildDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getConglomerateDescriptorsScan(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.finishTableDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTableDescriptorIndex1Scan(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getUncachedTableDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.catalog.NameTDCacheable.setIdentity(Unknown Source)
        at org.apache.derby.impl.services.cache.CachedItem.takeOnIdentity(Unknown Source)
        at org.apache.derby.impl.services.cache.Clock.addEntry(Unknown Source)
        at org.apache.derby.impl.services.cache.Clock.find(Unknown Source)
        at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTableDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.compile.QueryTreeNode.getTableDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
        at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
        at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
        at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
        at org.apache.derby.impl.sql.compile.CursorNode.bind(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
        at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
        at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.eclipse.wst.rdb.internal.core.connection.StatementAdapter.execute(StatementAdapter.java:50)
        at org.eclipse.wst.rdb.server.internal.ui.query.execute.QueryOutputHelper.runSQLScrapbookQuery(QueryOutputHelper.java:121)
        at org.eclipse.wst.rdb.sqleditor.internal.actions.SQLRunAction.run(SQLRunAction.java:231)
        at com.ibm.datatools.cloudscapeworkbench.actions.RunSQLAction.run(RunSQLAction.java:20)
        at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
        at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
        at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
        at com.ibm.datatools.cloudscapeworkbench.CloudscapeWorkbench.run(CloudscapeWorkbench.java:16)
        at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
        at org.eclipse.core.launcher.Main.run(Main.java:973)
        at org.eclipse.core.launcher.Main.main(Main.java:948)
        Cleanup action completed

        2007-06-07 19:28:35.196 GMT:
        Shutting down instance c013800d-0113-07a7-63b0-0000001e9dd8
        ----------------------------------------------------------------

        Show
        Mike Matrigali added a comment - Here is the derby.log from the report of this issue in the derby-user list: ---------------------------------------------------------------- 2007-06-07 19:26:57.054 GMT: Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.2.0 - (485682): instance c013800d-0113-07a7-63b0-0000001e9dd8 on database directory C:\workspace\SeedTrak2\Database\SeedTrakDB Database Class Loader started - derby.database.classpath='' 2007-06-07 19:27:28.679 GMT Thread [main,6,main] (XID = 38), (SESSIONID = 0), (DATABASE = C:\workspace\SeedTrak2\Database\SeedTrakDB), (DRDAID = null), Cleanup action starting 2007-06-07 19:27:28.679 GMT Thread [main,6,main] (XID = 38), (SESSIONID = 0), (DATABASE = C:\workspace\SeedTrak2\Database\SeedTrakDB), (DRDAID = null), Failed Statement is: select * from dealer java.lang.NullPointerException at java.io.StringReader.<init>(Unknown Source) at org.apache.derby.impl.services.uuid.BasicUUID.<init>(Unknown Source) at org.apache.derby.impl.services.uuid.BasicUUIDFactory.recreateUUID(Unknown Source) at org.apache.derby.impl.sql.catalog.SYSCONGLOMERATESRowFactory.buildDescriptor(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getConglomerateDescriptorsScan(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.finishTableDescriptor(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTableDescriptorIndex1Scan(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getUncachedTableDescriptor(Unknown Source) at org.apache.derby.impl.sql.catalog.NameTDCacheable.setIdentity(Unknown Source) at org.apache.derby.impl.services.cache.CachedItem.takeOnIdentity(Unknown Source) at org.apache.derby.impl.services.cache.Clock.addEntry(Unknown Source) at org.apache.derby.impl.services.cache.Clock.find(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTableDescriptor(Unknown Source) at org.apache.derby.impl.sql.compile.QueryTreeNode.getTableDescriptor(Unknown Source) at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source) at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source) at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source) at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source) at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source) at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source) at org.apache.derby.impl.sql.compile.CursorNode.bind(Unknown Source) at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source) at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source) at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) at org.eclipse.wst.rdb.internal.core.connection.StatementAdapter.execute(StatementAdapter.java:50) at org.eclipse.wst.rdb.server.internal.ui.query.execute.QueryOutputHelper.runSQLScrapbookQuery(QueryOutputHelper.java:121) at org.eclipse.wst.rdb.sqleditor.internal.actions.SQLRunAction.run(SQLRunAction.java:231) at com.ibm.datatools.cloudscapeworkbench.actions.RunSQLAction.run(RunSQLAction.java:20) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at com.ibm.datatools.cloudscapeworkbench.CloudscapeWorkbench.run(CloudscapeWorkbench.java:16) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948) Cleanup action completed 2007-06-07 19:28:35.196 GMT: Shutting down instance c013800d-0113-07a7-63b0-0000001e9dd8 ----------------------------------------------------------------

          People

          • Assignee:
            Unassigned
            Reporter:
            Mike Matrigali
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development