db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (DERBY-6887) NullPointer in org.apache.derby.impl.sql.catalog.DataDictionaryImpl#getTransactionCompile
Date Tue, 10 May 2016 02:08:12 GMT

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

Bryan Pendleton edited comment on DERBY-6887 at 5/10/16 2:07 AM:
-----------------------------------------------------------------

Thanks for supplying the log. There is some interesting information
starting at about line 4785 in the log, just a little bit before the NPE
occurs; it shows:

{quote}
Derby could not obtain the locks needed to release the unused, preallocated values for the
sequence 'SYS'.'Ue944c7a3X0154X84d2Xe7a6X00000d5ac3d8'. As a result, unexpected gaps may appear
in this sequence.
Fri May 06 08:48:39 CEST 2016 Thread[main,5,main] (XID = 2383), (SESSIONID = 349), (DATABASE
= /tmp/testDB), (DRDAID = null), Cleanup action starting
Fri May 06 08:48:39 CEST 2016 Thread[main,5,main] (XID = 2383), (SESSIONID = 349), (DATABASE
= /tmp/testDB), (DRDAID = null), Failed Statement is: DROP TABLE "APP"."LOCATIONS"
ERROR XSLAQ: Cannot create log file at directory /tmp/testDB/log.
        at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
        at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.getLogDirectory(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.getLogFileName(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.switchLogFile(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
        at org.apache.derby.impl.store.raw.log.FileLogger.flush(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.Xact.prepareCommit(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
        at org.apache.derby.impl.store.access.RAMTransaction.commit(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SequenceUpdater.updateCurrentValueOnDisk(Unknown
Source)
        at org.apache.derby.impl.sql.catalog.SequenceUpdater.clean(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.execute.DropSequenceConstantAction.executeConstantAction(Unknown
Source)
        at org.apache.derby.impl.sql.execute.DropTableConstantAction.dropIdentitySequence(Unknown
Source)
        at org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(Unknown
Source)
        at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
{quote}

I wonder if, somehow, this locking problem with the sequence object handling
is the real root of the problems you're seeing.



was (Author: bryanpendleton):
Thanks for supplying the log. There is some interesting information
starting at about line 4785 in the log, just a little bit before the NPE
occurs; it shows:

{blockquote}
Derby could not obtain the locks needed to release the unused, preallocated values for the
sequence 'SYS'.'Ue944c7a3X0154X84d2Xe7a6X00000d5ac3d8'. As a result, unexpected gaps may appear
in this sequence.
Fri May 06 08:48:39 CEST 2016 Thread[main,5,main] (XID = 2383), (SESSIONID = 349), (DATABASE
= /tmp/testDB), (DRDAID = null), Cleanup action starting
Fri May 06 08:48:39 CEST 2016 Thread[main,5,main] (XID = 2383), (SESSIONID = 349), (DATABASE
= /tmp/testDB), (DRDAID = null), Failed Statement is: DROP TABLE "APP"."LOCATIONS"
ERROR XSLAQ: Cannot create log file at directory /tmp/testDB/log.
        at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
        at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.getLogDirectory(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.getLogFileName(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.switchLogFile(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
        at org.apache.derby.impl.store.raw.log.LogToFile.flush(Unknown Source)
        at org.apache.derby.impl.store.raw.log.FileLogger.flush(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.Xact.prepareCommit(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
        at org.apache.derby.impl.store.raw.xact.Xact.commit(Unknown Source)
        at org.apache.derby.impl.store.access.RAMTransaction.commit(Unknown Source)
        at org.apache.derby.impl.sql.catalog.SequenceUpdater.updateCurrentValueOnDisk(Unknown
Source)
        at org.apache.derby.impl.sql.catalog.SequenceUpdater.clean(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.execute.DropSequenceConstantAction.executeConstantAction(Unknown
Source)
        at org.apache.derby.impl.sql.execute.DropTableConstantAction.dropIdentitySequence(Unknown
Source)
        at org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(Unknown
Source)
        at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
{blockquote}

I wonder if, somehow, this locking problem with the sequence object handling
is the real root of the problems you're seeing.


> NullPointer in org.apache.derby.impl.sql.catalog.DataDictionaryImpl#getTransactionCompile
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-6887
>                 URL: https://issues.apache.org/jira/browse/DERBY-6887
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.12.1.1
>         Environment: ------------------ Java-Informationen ------------------
> Java-Version: 1.8.0_77
> Java-Anbieter: Oracle Corporation
> Java Home: /usr/lib/jvm/java-8-oracle/jre
> Java Classpath: /home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derby.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbynet.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbytools.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyoptionaltools.jar:/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyclient.jar
> BS-Name: Linux
> BS-Architektur: amd64
> BS-Version: 4.4.0-21-generic
> Java-Benutzername: developercookie
> Java-Benutzer-Home: /home/developercookie
> Java-Benutzerverzeichnis: /home/developercookie/Downloads/db-derby-10.12.1.1-bin/bin
> java.specification.name: Java Platform API Specification
> java.specification.version: 1.8
> java.runtime.version: 1.8.0_77-b03
> --------- Derby-Informationen --------
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derby.jar] 10.12.1.1 - (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbytools.jar] 10.12.1.1
- (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbynet.jar] 10.12.1.1 -
(1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyclient.jar] 10.12.1.1
- (1704137)
> [/home/developercookie/Downloads/db-derby-10.12.1.1-bin/lib/derbyoptionaltools.jar] 10.12.1.1
- (1704137)
> ------------------------------------------------------
> ----------------- Informationen zum Gebietsschema -----------------
> Aktuelles Gebietsschema:  [Deutsch/Deutschland [de_DE]]
> Folgende Gebietsschemaunterstützung gefunden: [cs]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [de_DE]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [es]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [fr]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [hu]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [it]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [ja_JP]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [ko_KR]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [pl]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [pt_BR]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [ru]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [zh_CN]
> 	 Version: 10.12.1.1 - (1704137)
> Folgende Gebietsschemaunterstützung gefunden: [zh_TW]
> 	 Version: 10.12.1.1 - (1704137)
> ------------------------------------------------------
> ------------------------------------------------------
>            Reporter: Developercookie
>         Attachments: derby.log.gz
>
>
> Hi,
> I'm using Derby in my application. For migrating databases I use the small library Flayway.
While running tests I encountered a NullPointerException when Flayway tries to drop tables
for clean up. After digging into the Flayway code I found that the root cause is a NullPointerException
within Derby in the method {{org.apache.derby.impl.sql.catalog.DataDictionaryImpl#getTransactionCompile}}.
This method calls another method {{getLCC()}} that can return a {{null}} value and this causes
the {{NullPointerException}}
> NullPointerException stacktrace:
> {code}
> org.flywaydb.core.api.FlywayException: Unable to drop "APP"."LOCATIONS"
> 	at org.flywaydb.core.internal.dbsupport.SchemaObject.drop(SchemaObject.java:82)
> 	at org.flywaydb.core.internal.dbsupport.derby.DerbySchema.doClean(DerbySchema.java:81)
> 	at org.flywaydb.core.internal.dbsupport.Schema.clean(Schema.java:148)
> 	at org.flywaydb.core.internal.command.DbClean$4.doInTransaction(DbClean.java:182)
> 	at org.flywaydb.core.internal.command.DbClean$4.doInTransaction(DbClean.java:180)
> 	at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
> 	at org.flywaydb.core.internal.command.DbClean.cleanSchema(DbClean.java:180)
> 	at org.flywaydb.core.internal.command.DbClean.clean(DbClean.java:130)
> 	at org.flywaydb.core.Flyway$3.execute(Flyway.java:1017)
> 	at org.flywaydb.core.Flyway$3.execute(Flyway.java:1013)
> 	at org.flywaydb.core.Flyway.execute(Flyway.java:1361)
> 	at org.flywaydb.core.Flyway.clean(Flyway.java:1013)
> 	at org.developercookie.account.dao.DBHelper.cleanupDatabase(DBHelper.java:64)
> 	at org.developercookie.account.dao.SingleTransactionDAOTest.cleanupDatabase(SingleTransactionDAOTest.java:235)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
> Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(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.execute(Unknown Source)
> 	at org.flywaydb.core.internal.dbsupport.JdbcTemplate.execute(JdbcTemplate.java:219)
> 	at org.flywaydb.core.internal.dbsupport.derby.DerbyTable.doDrop(DerbyTable.java:43)
> 	at org.flywaydb.core.internal.dbsupport.SchemaObject.drop(SchemaObject.java:80)
> 	... 44 more
> Caused by: ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> 	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source)
> 	... 58 more
> Caused by: java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getTransactionCompile(Unknown
Source)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getDescriptorViaIndex(Unknown
Source)
> 	at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSequenceDescriptor(Unknown
Source)
> 	at org.apache.derby.impl.sql.execute.DropSequenceConstantAction.executeConstantAction(Unknown
Source)
> 	at org.apache.derby.impl.sql.execute.DropTableConstantAction.dropIdentitySequence(Unknown
Source)
> 	at org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(Unknown
Source)
> 	at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
> 	... 50 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message