H2 Database Corruption - File corrupted while reading record

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

Summary

After restarting Bamboo, it fails to start with a "File corrupted while reading record: null" error.

Environment

Any supported version of Bamboo (observed in Bamboo 7.2.6).

Diagnosis

The following error is found on atlassian-bamboo.log file: 

ERROR [BootstrapUpgradeHelper] Error getting database connection
org.hibernate.HibernateException: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: File corrupted while reading record: null. Possible solution: use the recovery tool [90030-199]

Cause

The error indicates that a database corruption has occurred in the H2 database. This can happen for different reasons such as disk space limitations or an abrupt server shutdown.

Solution

Bamboo ships with a built-in H2 database, which is intended for evaluation purposes but is somewhat susceptible to data loss during system crashes. For production environments, the H2 database is not supported and we recommend that you connect Bamboo to an external database.

To resolve the database corruption issue, you can use the H2 Recover Tool to recover data from the H2 database file. The Recover tool will try to recover the corrupted data, but if the database is completely corrupted, the process of recovering the data might not be completed. In case the recovery tool fails to restore the H2 database data, the recommended path to restore the data would be to restore the entire <bamboo-home>  folder from a backup.

H2 Recovery Tool

To run the Recovery Tool you should use the following command, replacing <BAMBOO_INSTALL> with your Bamboo's install folder path:

java -cp <Bamboo-Install>/lib/h2*.jar org.h2.tools.Recover

Please note that the H2 Database is not supported by Atlassian.

Last modified on Jan 24, 2024

Was this helpful?

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