Confluence DB connection failed with H2 DB

Still need help?

The Atlassian Community is here for you.

Ask the community

For Atlassian eyes only

This article is Not Validated and cannot be shared with customers.


 

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Confluence connection to the H2 database is failing. 

Environment

Confluence version 6.13.6

Diagnosis

Confluence application would not start and the below error can be seen under the application logs on the startup 

2021-04-19 10:42:06,453 INFO [Catalina-utility-1] [com.atlassian.confluence.lifecycle] init Confluence is ready to serve
2021-04-19 10:42:06,485 WARN [C3P0PooledConnectionPoolManager[identityToken->z8kfsxag1siol3y1nsg187|7ecaf9a2]-HelperThread-#0] [mchange.v2.resourcepool.BasicResourcePool] log com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@10c7e87 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: File corrupted in chunk 4547007, expected page length 4..32, got 67 [1.4.196/6]" [50000-196]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
        at org.h2.message.DbException.get(DbException.java:168)
        at org.h2.message.DbException.convert(DbException.java:295)
        at org.h2.engine.Database.openDatabase(Database.java:307)
        at org.h2.engine.Database.<init>(Database.java:270)
        at org.h2.engine.Engine.openSession(Engine.java:64)
        at org.h2.engine.Engine.openSession(Engine.java:176)
        at org.h2.engine.Engine.createSessionAndValidate(Engine.java:154)
        at org.h2.engine.Engine.createSession(Engine.java:137)
        at org.h2.server.TcpServerThread.run(TcpServerThread.java:148)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: File corrupted in chunk 4547007, expected page length 4..32, got 67 [1.4.196/6]
        at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:765)
        at org.h2.mvstore.Page.read(Page.java:649)
        at org.h2.mvstore.Page.read(Page.java:195)
        at org.h2.mvstore.MVStore.readPage(MVStore.java:1952)
        at org.h2.mvstore.MVMap.readPage(MVMap.java:741)
        at org.h2.mvstore.MVMap.setRootPos(MVMap.java:751)
        at org.h2.mvstore.MVStore.openMap(MVStore.java:476)
        at org.h2.mvstore.db.TransactionStore.openMap(TransactionStore.java:393)
        at org.h2.mvstore.db.TransactionStore$Transaction.openMap(TransactionStore.java:747)
        at org.h2.mvstore.db.MVPrimaryIndex.<init>(MVPrimaryIndex.java:75)
        at org.h2.mvstore.db.MVTable.init(MVTable.java:122)
        at org.h2.mvstore.db.MVTableEngine.createTable(MVTableEngine.java:110)
        at org.h2.mvstore.db.MVTableEngine.createTable(MVTableEngine.java:42)
        at org.h2.schema.Schema.createTable(Schema.java:612)
        at org.h2.command.ddl.CreateTable.update(CreateTable.java:139)
        at org.h2.engine.MetaRecord.execute(MetaRecord.java:58)
        at org.h2.engine.Database.open(Database.java:763)
        at org.h2.engine.Database.openDatabase(Database.java:276)


Cause

The above error indicates that the H2 DB file( present under <Confluence home dir>/database) got corrupted possibly due to abrupt shutdown or other reasons. The H2 Database is being shipped for testing purposes only as documented under Confluence-supported platforms and it's prone to corruption. 

Solution

  • If Confluence backup is available, create a new Confluence instance using the backup. 
  • If Confluence backup is not available, then you can try to recover from this corruption using the H2 Recover Tool.
  • If the H2 recovery tool does not help, then you can try and download the latest H2 jar. Replace the H2 jar under <CONFLUENCE_INSTALL_DIR>/confluence/WEB-INF/lib and then check if the latest version of the H2 jar is able to recover from this corruption. 

Last modified on Apr 7, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.