File corrupted while reading record: Possible solution: use the recovery tool [90030-224]

180 views
Skip to first unread message

Balamurali Krishna Ippili

unread,
Jan 10, 2025, 1:39:06 AMJan 10
to H2 Database, Deepti Kulkarni
Hi Team,

We are getting a DB corruption issue intermittently with H2DB 2.2.224 version and following are the error details:

=================================================ERROR START====================================================================
Exception while CRUD field mappings getNimMdrFieldMappingsByMdr
org.h2.jdbc.JdbcSQLNonTransientConnectionException: File corrupted while reading record: "/opt/cloakware/cspmserver_thirdparty/tomcat/webapps/ca-nim-sm/WEB-INF/data/nim-sm-customizations.mv.db". Possible solution: use the recovery tool [90030-224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:690) ~[h2-2.2.224.jar:2.2.224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) ~[h2-2.2.224.jar:2.2.224]
at org.h2.message.DbException.get(DbException.java:212) ~[h2-2.2.224.jar:2.2.224]
at org.h2.mvstore.db.Store.convertMVStoreException(Store.java:163) ~[h2-2.2.224.jar:2.2.224]
at org.h2.mvstore.db.Store.<init>(Store.java:142) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Database.<init>(Database.java:326) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Engine.openSession(Engine.java:92) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Engine.openSession(Engine.java:222) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Engine.createSession(Engine.java:201) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) ~[h2-2.2.224.jar:2.2.224]
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125) ~[h2-2.2.224.jar:2.2.224]
at org.h2.Driver.connect(Driver.java:59) ~[h2-2.2.224.jar:1.3.176]
at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_432]
at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[?:1.8.0_432]
at com.j256.ormlite.jdbc.JdbcConnectionSource.makeConnection(JdbcConnectionSource.java:252) ~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadWriteConnection(JdbcConnectionSource.java:184) ~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadOnlyConnection(JdbcConnectionSource.java:170) ~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:243) ~[ormlite-core-4.48.jar:?]
at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:196) ~[ormlite-core-4.48.jar:?]
at com.j256.ormlite.dao.BaseDaoImpl.query(BaseDaoImpl.java:265) ~[ormlite-core-4.48.jar:?]
at com.ca.integration.normalization.common.persistence.FieldMappingsDbPersistenceImpl.getNimMdrFieldMappingsByMdr(FieldMappingsDbPersistenceImpl.java:139) ~[ca-nim-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at com.ca.integration.normalization.common.SMFieldMappingHandler.cloneMappings(SMFieldMappingHandler.java:1437) ~[ca-nim-sm-core-3.2.0-SNAPSHOT.jar:3.2.0-SNAPSHOT]

=================================================ERROR END====================================================================

The DB is getting corrupted when we are reading a table which contains only 225 records in it. It is not a huge DB or we don't have more than 20 small tables init. The issue is occurring intermittently and not able to understand the pattern but it is failing with the same error message "org.h2.jdbc.JdbcSQLNonTransientConnectionException: File corrupted while reading record:", This is occurring on the fly when the application is running and we cannot use the recovery tool here as suggested in the error message "Possible solution: use the recovery tool [90030-224]"

The getNimMdrFieldMappingsByMdr function  is just reading 225 records(key value pair data) from a H2DB table but it is not successful sometimes with no reason other than reporting the DB corruption issue.


Following are the details:
===================
H2 DB version - 2.2.224
Java version : OpenJDK8
Application Server : Tomcat 9.x

Can any one help here to understand the issue and suggest on how to address this issue? Let me know if we have a quick call to check the same.


Thanks,
Balamurali





This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.

Andreas Reichel

unread,
Jan 10, 2025, 2:23:24 AMJan 10
to h2-da...@googlegroups.com
Greetings,

I am a user only but my understanding is:

1) please use the latest H2 release since anything prior 2.3.232 had serious issues
2) unless you can show a Java only, self containing (and free of third-party software) reproducer, nobody will be able to help you

Personal experience:

We are running 21 large databases (e.g. 20GB data each, 120 indexed tables) using  H2 2.3.239 Snapshot in a multi country, multi user environment, massive daily DML.

It runs mostly stable, but depends on regular "SHUTDOWN DEFRAG" (or else db file will explode).
Corruption seems to occur sometimes (like 1/100?), but was always recoverable.

Important: set the TEMP folder explicitly for very large databases because H2 will create large temp files (easily exhausting the default /tmp size).

Good luck and cheers
Andreas 
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/h2-database/CAG6_yCCDoFrpeVx6%3DgS6_FGh4LiKi94Wqegghmi20SijMRgvqg%40mail.gmail.com.

Balamurali Krishna Ippili

unread,
Jan 10, 2025, 2:35:40 AMJan 10
to h2-da...@googlegroups.com, Deepti Kulkarni, Praveen Kumar Gudupalli
HI Andreas,

Thank you so  much for your quick response. Really appreciate it.

It is good to know that even if you are using multiple large DBs using H2DB not facing any/no issues.

1. We are currently using java 8 and as per my understanding the latest version of H2DB 2.3.232 requires java 11 and above and we cannot simply upgrade to java 11 at this moment as there are a lot of application specific changes  so we need to plan for the same at a later point of time.

2.  Can you please elaborate on the following so I can work on that? 
"unless you can show a Java only, self containing (and free of third-party software) reproducer"

3. As mentioned, it is occurring intermittently but not always.

Please let me know if we can have a quick call to discuss this and proceed further.


Thanks,
Balamurali




Andreas Reichel

unread,
Jan 10, 2025, 2:54:05 AMJan 10
to h2-da...@googlegroups.com
On Fri, 2025-01-10 at 13:05 +0530, 'Balamurali Krishna Ippili' via H2 Database wrote:
1. We are currently using java 8 and as per my understanding the latest version of H2DB 2.3.232 requires java 11 and above and we cannot simply upgrade to java 11 at this moment as there are a lot of application specific changes  so we need to plan for the same at a later point of time.

I understand this challenge well since we are maintaining various software projects bound to JDK 11 but find it increasingly difficult since most tooling and libraries depend on JDK 17 those days.

Lets face reality: time of JDK 8 is up and you will have a hard time to get any support with those old versions of H2.

Also, from my personal experience I can say: 2.3.232 was the first (almost) production quality release of H2 and I have tried every single version since 1.4.196 or so.


2.  Can you please elaborate on the following so I can work on that? 
"unless you can show a Java only, self containing (and free of third-party software) reproducer

You trace shows lots of ORM and middle ware. Nobody will peel those layers from the onion.
Instead, simple Java JDBC and statements, maybe running in a loop and eventually yielding in this corruption. Only then a developer will be able to trace it.

(And WHEN you provide such a re-producer the H2 developers are all in and very helpful!)

Evgenij Ryazanov

unread,
Jan 10, 2025, 3:24:45 AMJan 10
to H2 Database
Hello!

> /opt/cloakware/cspmserver_thirdparty/tomcat/webapps/ca-nim-sm/WEB-INF/data/nim-sm-customizations.mv.db

If database is not read-only, its file must not be located in webapps directory of Tomcat. Tomcat can overwrite this directory.

Embedded persistent databases also need special care about their lifecycle, web application needs to have a context listener and this listener should shutdown the database in its contextDestroyed() method and application must ensure that no new connections will be opened after that.

2.2.224 also has some known problems. So there are too many things that can go wrong.

Balamurali Krishna Ippili

unread,
Jan 10, 2025, 3:33:20 AMJan 10
to h2-da...@googlegroups.com, Praveen Kumar Gudupalli
Hi  Andreas,

Thanks for your inputs and will check further on this.

Regards,
Balamurali

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.

Balamurali Krishna Ippili

unread,
Jan 10, 2025, 3:36:04 AMJan 10
to h2-da...@googlegroups.com
Hi Evgenij,

Thanks for your reply and the points that you have mentioned and will try to upgrade to the latest version of H2DB but it has some java version challenges so I am thinking on it.

Regards,
Balamurali

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages