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

Mamta A. Satoor commented on DERBY-5422:
----------------------------------------

I followed up on Mike's comment to this jira(on 03/Oct/11). 

derby.log shows IndexOutOfBoundsException followed by NullPointerException 
during the cleanup of exception received by SequenceUpdater.clearIdentity. But 
the original exception encountered by 
org.apache.derby.impl.sql.catalog.SequenceUpdater.clearIdentity never gets 
reported. 

The SequenceUpdater.clearIdentity has a try catch which calls 
org.apache.derby.iapi.services.context.ContextManager.cleanupOnError if an 
exception is caught. It looks like cleanupOnError only conditionally logs the 
information about the original exception. cleanupOnError has following check 
before it prints original exeption info in derby.log
                boolean reportError = reportError(error);
If reportError is false, cleanupOnError does not log any information about the 
original exception. 
reportError() method returns false 
1)if the exception is ShutdownException or
2)if the exception is a StandardException and for some reason, it's reporting 
type is set to StandardException.REPORT_NEVER or
3)if the exception is a StandardException and it's reporting type is set to 
StandardException.REPORT_DEFAULT but it's severity level is not as expected

I am not sure why do we not log all kinds of exceptions while cleaning up the 
context on that exception. Having the information about the original exception 
will definitely help us figure out why SequenceUpdate.clearIdentity failed. 

I can think of two options at this point(there might be other ways to handle 
this too)
1)Log all kinds of exceptions in ContextManager.cleanupOnError irrespective of 
what reportError says or
2)Check in SequenceUpdate.clearIdentity if the exception caught has reportError 
set to false. If so, then go ahead and log it before calling 
ContextManager.cleanupOnError

For now, I will go ahead and work on a temporary patch based on option 2). We 
can then rerun nstest using that patch and hope that it runs into 
IndexOutOfBoundsException again but this time, we will log the original error 
in derby.log

In order to make sure that my changes do work, in my codeline, I will force 
trace my code changes to make sure that we log the exception received by 
clearIdentity.

                
> IndexOutOfBoundsException followed by NullPointerException in cleanup during 
> system.nstest 
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5422
>                 URL: https://issues.apache.org/jira/browse/DERBY-5422
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.8.2.1
>         Environment: Windows XP, with ibm 1.6 SR9 FP1
>            Reporter: Myrna van Lunteren
>         Attachments: run2.jar, run7.jar
>
>
> During the embedded NsTest system test on windows XP I saw the following in 
> derby.log:
> Tue Sep 13 16:25:03 PDT 2011:
> Booting Derby version The Apache Software Foundation - Apache Derby - 
> 10.8.2.1 - (1170221): instance b779ce27-0132-6516-81e1-000000312348 
> on database directory D:\10.8.2.1\tst\restoredir\nstestdb  with class loader 
> sun.misc.Launcher$AppClassLoader@40504050 
> Loaded from file:/D:/10.8.2.1/jars/derby.jar
> java.vendor=IBM Corporation
> java.runtime.version=jvmwi3260sr9-20110203_74623
> java.fullversion=JRE 1.6.0 IBM J9 2.4 Windows Server 2003 x86-32 
> jvmwi3260sr9-20110203_74623 (JIT enabled, AOT enabled)
> J9VM - 20110203_074623
> JIT  - r9_20101028_17488ifx3
> GC   - 20101027_AA
> user.dir=D:\10.8.2.1\tst
> derby.system.home=null
> New exception raised during cleanup Index: -1, Size: 15
> java.lang.IndexOutOfBoundsException: Index: -1, Size: 15
>       at java.util.ArrayList.remove(ArrayList.java:552)
>       at 
> org.apache.derby.iapi.services.context.ContextManager.popContext(Unknown 
> Source)
>       at org.apache.derby.iapi.services.context.ContextImpl.popMe(Unknown 
> Source)
>       at org.apache.derby.impl.store.access.RAMTransaction.destroy(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.doRollback(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.internalRollback(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.cleanupOnError(Unknown
>  Source)
>       at 
> org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.catalog.SequenceUpdater.clearIdentity(Unknown 
> Source)
>       at 
> org.apache.derby.impl.services.cache.ConcurrentCache.removeEntry(Unknown 
> Source)
>       at org.apache.derby.impl.services.cache.ConcurrentCache.ageOut(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.catalog.DataDictionaryImpl.clearSequenceCaches(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.catalog.DataDictionaryImpl.clearCaches(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.catalog.DataDictionaryImpl.doneReading(Unknown 
> Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepareStorable(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.sql.dictionary.SPSDescriptor.compileStatement(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.sql.dictionary.SPSDescriptor.prepareAndRelease(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.sql.dictionary.SPSDescriptor.getPreparedStatement(Unknown
>  Source)
>       at 
> org.apache.derby.iapi.sql.dictionary.SPSDescriptor.getPreparedStatement(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.DeleteResultSet.fireAfterTriggers(Unknown 
> Source)
>       at org.apache.derby.impl.sql.execute.DeleteResultSet.open(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>       at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>       at 
> org.apache.derbyTesting.system.nstest.utils.DbUtil.delete_one_row(DbUtil.java:452)
>       at 
> org.apache.derbyTesting.system.nstest.tester.TesterObject.doIUDOperation(TesterObject.java:175)
>       at 
> org.apache.derbyTesting.system.nstest.tester.Tester1.startTesting(Tester1.java:118)
>       at org.apache.derbyTesting.system.nstest.NsTest.run(NsTest.java:551)
> Cleanup action completed
> New exception raised during cleanup null
> java.lang.NullPointerException
>       at 
> org.apache.derby.impl.sql.compile.CompilerContextImpl.initRequiredPriv(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.compile.CompilerContextImpl.resetContext(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.compile.CompilerContextImpl.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> 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.EmbedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>       at 
> org.apache.derbyTesting.system.nstest.utils.DbUtil.delete_one_row(DbUtil.java:452)
>       at 
> org.apache.derbyTesting.system.nstest.tester.TesterObject.doIUDOperation(TesterObject.java:175)
>       at 
> org.apache.derbyTesting.system.nstest.tester.Tester1.startTesting(Tester1.java:118)
>       at org.apache.derbyTesting.system.nstest.NsTest.run(NsTest.java:551)
> Tue Sep 13 16:25:12 PDT 2011 Thread[Thread 1,5,main] Equally severe exception 
> raised during cleanup (ignored) null
> java.lang.NullPointerException
>       at 
> org.apache.derby.impl.sql.compile.CompilerContextImpl.initRequiredPriv(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.compile.CompilerContextImpl.resetContext(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.compile.CompilerContextImpl.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.iapi.services.context.ContextManager.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.cleanupOnError(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> 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.EmbedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>       at 
> org.apache.derbyTesting.system.nstest.utils.DbUtil.delete_one_row(DbUtil.java:452)
>       at 
> org.apache.derbyTesting.system.nstest.tester.TesterObject.doIUDOperation(TesterObject.java:175)
>       at 
> org.apache.derbyTesting.system.nstest.tester.Tester1.startTesting(Tester1.java:118)
>       at org.apache.derbyTesting.system.nstest.NsTest.run(NsTest.java:551)
> Cleanup action completed
> It appears this caused the Tester1 thread to loose the connection:
> ---------------------
> Tester1Thread 1 dbUtil ----> During failure to execute delete stmt, exception 
> thrown was : java.sql.SQLTransactionRollbackException: An internal error was 
> identified by RawStore module.
> TObj -->At this point - executing delete_one_row(), exception thrown was : No 
> current connection.
> java.sql.SQLNonTransientConnectionException: No current connection.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>       at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown 
> Source)
>       at 
> org.apache.derbyTesting.system.nstest.utils.DbUtil.add_one_row(DbUtil.java:96)
>       at 
> org.apache.derbyTesting.system.nstest.tester.TesterObject.doIUDOperation(TesterObject.java:148)
>       at 
> org.apache.derbyTesting.system.nstest.tester.Tester1.startTesting(Tester1.java:118)
>       at org.apache.derbyTesting.system.nstest.NsTest.run(NsTest.java:551)
> Caused by: java.sql.SQLException: No current connection.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>       ... 12 more
> -------------------------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to