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 "Michael Closson (JIRA)" <ji...@apache.org> on 2010/06/11 20:12:30 UTC

[jira] Created: (DERBY-4697) After an abnormal shutdown, cannot connect to derby DB.

After an abnormal shutdown, cannot connect to derby DB.
-------------------------------------------------------

                 Key: DERBY-4697
                 URL: https://issues.apache.org/jira/browse/DERBY-4697
             Project: Derby
          Issue Type: Bug
          Components: Store
    Affects Versions: 10.3.3.0
         Environment: Linux RHEL5. 64 bit.  Embedded DERBY.
            Reporter: Michael Closson


My company uses embedded derby DB for persistence (w/ hibernate) in one of our server products.  We have been using it for several years now.

We are using derby version 10.3.  (Bundle-Version: 10.3.1000004.561794)

Recently at a customer site, the server couldn't start because it could not connect to the database. It happened after the server shutdown abnormally.  The error message reported in the log file is:

Caused by: java.sql.SQLException: Failed to start database 'db', see the next exception for details.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
        at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
        at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
        at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:65)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:66)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.initializeAutomaticTestTable(C3P0PooledConnectionPoolManager.java:472)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:406)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:327)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:345)
        at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:64)
        at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
        at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
        at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
        at org.hibernate.loader.Loader.doQuery(Loader.java:390)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
        at org.hibernate.loader.Loader.doList(Loader.java:1593)
        at org.hibernate.loader.Loader.list(Loader.java:1577)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
        ... 11 more
Caused by: java.sql.SQLException: Java exception: ': java.lang.IndexOutOfBoundsException'.
        at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
        ... 37 more


Indeed, if I try to connect to the database with IJ, I get the same error.

If I connect with jars that I built from derby source (10.6, latest) I get a different error:

[mclosson@magrath work]$ java org.apache.derby.tools.ij
ij version 10.6
ij> connect 'jdbc:derby:db';
org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Wrong LogInstant on log record (1392542017,37698) version real position (392,719194)
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
	at org.apache.derby.impl.store.raw.log.Scan.getNextRecordForward(Scan.java:810)
	at org.apache.derby.impl.store.raw.log.Scan.getNextRecord(Scan.java:206)
	at org.apache.derby.impl.store.raw.log.FileLogger.readLogRecord(FileLogger.java:1612)
	at org.apache.derby.impl.store.raw.log.LogToFile.findCheckpoint(LogToFile.java:2806)
	at org.apache.derby.impl.store.raw.log.LogToFile.recover(LogToFile.java:756)
	at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:339)
...


Perhaps derby wrote an incomplete log record, and now cannot recover?  Also, if I delete the log control file (log.ctrl) then I can connect OK.  But if I do this, is there risk that some transactions will be lost?  (I think so).


I have the database that causes this error, but I prefer to not post it to the bug log or mailing list.  But if someone emails me directly, I will supply it.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4697) After an abnormal shutdown, cannot connect to derby DB.

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878519#action_12878519 ] 

Knut Anders Hatlen commented on DERBY-4697:
-------------------------------------------

Could you clarify what's meant by "the server shutdown abnormally"? Was it a power failure, an application crash, or something else? Thanks.

> After an abnormal shutdown, cannot connect to derby DB.
> -------------------------------------------------------
>
>                 Key: DERBY-4697
>                 URL: https://issues.apache.org/jira/browse/DERBY-4697
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.3.0
>         Environment: Linux RHEL5. 64 bit.  Embedded DERBY.
>            Reporter: Michael Closson
>
> My company uses embedded derby DB for persistence (w/ hibernate) in one of our server products.  We have been using it for several years now.
> We are using derby version 10.3.  (Bundle-Version: 10.3.1000004.561794)
> Recently at a customer site, the server couldn't start because it could not connect to the database. It happened after the server shutdown abnormally.  The error message reported in the log file is:
> Caused by: java.sql.SQLException: Failed to start database 'db', see the next exception for details.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
>         at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
>         at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
>         at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
>         at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:65)
>         at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:66)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.initializeAutomaticTestTable(C3P0PooledConnectionPoolManager.java:472)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:406)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:327)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:345)
>         at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:64)
>         at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
>         at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
>         at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
>         at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
>         at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
>         at org.hibernate.loader.Loader.doQuery(Loader.java:390)
>         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
>         at org.hibernate.loader.Loader.doList(Loader.java:1593)
>         at org.hibernate.loader.Loader.list(Loader.java:1577)
>         at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
>         at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
>         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
>         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
>         ... 11 more
> Caused by: java.sql.SQLException: Java exception: ': java.lang.IndexOutOfBoundsException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>         ... 37 more
> Indeed, if I try to connect to the database with IJ, I get the same error.
> If I connect with jars that I built from derby source (10.6, latest) I get a different error:
> [mclosson@magrath work]$ java org.apache.derby.tools.ij
> ij version 10.6
> ij> connect 'jdbc:derby:db';
> org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Wrong LogInstant on log record (1392542017,37698) version real position (392,719194)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.raw.log.Scan.getNextRecordForward(Scan.java:810)
> 	at org.apache.derby.impl.store.raw.log.Scan.getNextRecord(Scan.java:206)
> 	at org.apache.derby.impl.store.raw.log.FileLogger.readLogRecord(FileLogger.java:1612)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.findCheckpoint(LogToFile.java:2806)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.recover(LogToFile.java:756)
> 	at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:339)
> ...
> Perhaps derby wrote an incomplete log record, and now cannot recover?  Also, if I delete the log control file (log.ctrl) then I can connect OK.  But if I do this, is there risk that some transactions will be lost?  (I think so).
> I have the database that causes this error, but I prefer to not post it to the bug log or mailing list.  But if someone emails me directly, I will supply it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4697) After an abnormal shutdown, cannot connect to derby DB.

Posted by "Michael Closson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878535#action_12878535 ] 

Michael Closson commented on DERBY-4697:
----------------------------------------

The java process was killed with SIGKILL.

> After an abnormal shutdown, cannot connect to derby DB.
> -------------------------------------------------------
>
>                 Key: DERBY-4697
>                 URL: https://issues.apache.org/jira/browse/DERBY-4697
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.3.0
>         Environment: Linux RHEL5. 64 bit.  Embedded DERBY.
>            Reporter: Michael Closson
>
> My company uses embedded derby DB for persistence (w/ hibernate) in one of our server products.  We have been using it for several years now.
> We are using derby version 10.3.  (Bundle-Version: 10.3.1000004.561794)
> Recently at a customer site, the server couldn't start because it could not connect to the database. It happened after the server shutdown abnormally.  The error message reported in the log file is:
> Caused by: java.sql.SQLException: Failed to start database 'db', see the next exception for details.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
>         at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source)
>         at org.apache.derby.jdbc.Driver30.getNewEmbedConnection(Unknown Source)
>         at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
>         at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
>         at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:65)
>         at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:66)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.initializeAutomaticTestTable(C3P0PooledConnectionPoolManager.java:472)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createPooledConnectionPool(C3P0PooledConnectionPoolManager.java:406)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:327)
>         at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.getPool(C3P0PooledConnectionPoolManager.java:345)
>         at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:64)
>         at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
>         at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
>         at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
>         at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
>         at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
>         at org.hibernate.loader.Loader.doQuery(Loader.java:390)
>         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
>         at org.hibernate.loader.Loader.doList(Loader.java:1593)
>         at org.hibernate.loader.Loader.list(Loader.java:1577)
>         at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
>         at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
>         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
>         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
>         ... 11 more
> Caused by: java.sql.SQLException: Java exception: ': java.lang.IndexOutOfBoundsException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>         at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>         ... 37 more
> Indeed, if I try to connect to the database with IJ, I get the same error.
> If I connect with jars that I built from derby source (10.6, latest) I get a different error:
> [mclosson@magrath work]$ java org.apache.derby.tools.ij
> ij version 10.6
> ij> connect 'jdbc:derby:db';
> org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Wrong LogInstant on log record (1392542017,37698) version real position (392,719194)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.raw.log.Scan.getNextRecordForward(Scan.java:810)
> 	at org.apache.derby.impl.store.raw.log.Scan.getNextRecord(Scan.java:206)
> 	at org.apache.derby.impl.store.raw.log.FileLogger.readLogRecord(FileLogger.java:1612)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.findCheckpoint(LogToFile.java:2806)
> 	at org.apache.derby.impl.store.raw.log.LogToFile.recover(LogToFile.java:756)
> 	at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:339)
> ...
> Perhaps derby wrote an incomplete log record, and now cannot recover?  Also, if I delete the log control file (log.ctrl) then I can connect OK.  But if I do this, is there risk that some transactions will be lost?  (I think so).
> I have the database that causes this error, but I prefer to not post it to the bug log or mailing list.  But if someone emails me directly, I will supply it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.