You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
H2 file gets corrupted upon application shutdwon #4083
We've registered a lot of cases when the H2 database gets corrupted upon shutdown of the (Java) application which is connected to a database. Exceptions coming from H2 vary:
EOFException
MVStoreException: Double mark
MVStoreException: File is corrupted - unable to recover a valid set of chunks
I'll put stack traces towards the end of the ticket. Issues were detected on H2 version 2.2.224
Occurrences are random, effort to pinpoint the exact conditions under this happens leads to no result. No recovery method typically works on DB files corrupted in this way.
Can this please be fixed, if possible, or at least logging improved to help identify the root cause in the future?
Caused by: org.h2.mvstore.MVStoreException: Double mark: 77b/3d [389-3c3, 3c6-40c, 41b-4a4, 4cb-5d1, 5f3-5f3, 5ff-62b, 635-63c, 647-64b, 667-667, 6b1-6be, 6c3-6cd, 6f5-6f5, 72c-72d, 783-785, 7a6-7a9, 7b0-7c0, 7d1-7d5, 7fe-] [2.2.224/6]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
at org.h2.mvstore.FreeSpaceBitSet.markUsed(FreeSpaceBitSet.java:184)
at org.h2.mvstore.RandomAccessStore.markUsed(RandomAccessStore.java:75)
at org.h2.mvstore.RandomAccessStore.readStoreHeader(RandomAccessStore.java:333)
at org.h2.mvstore.FileStore.start(FileStore.java:916)
at org.h2.mvstore.MVStore.<init>(MVStore.java:289)
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2035)
at org.h2.mvstore.db.Store.<init>(Store.java:133)
... 15 more
If your application doesn't do anything with database during its termination, make sure you don't have a dangerous DB_CLOSE_ON_EXIT=FALSE in JDBC URL.
If your application has a shutdown hook and it works with database in it, this setting is needed, but your application must execute the SHUTDOWN command in the end and it may not open any new connections to database after that.
If process can be forcibly killed, it would be better not to use an embedded database in it, in that case a standalone H2 Server process, possibly launched as a system service, should be used.
Your issue also looks like duplicate of #2752, it was fixed in H2 2.3.230.
please retry with the latest GitHub Source, since 224 release quite some issues regarding such corruption have been fixed.
@katzyn@andreitokar@grandinj If you agree I would go through the open issues and close any corruption related ticket prior 230. I think at this point re-opening would be necessary if really anything was left over after your fixes. Do you agree and shall we?
Activity
katzyn commentedon Jul 21, 2024
If your application doesn't do anything with database during its termination, make sure you don't have a dangerous
DB_CLOSE_ON_EXIT=FALSEin JDBC URL.If your application has a shutdown hook and it works with database in it, this setting is needed, but your application must execute the
SHUTDOWNcommand in the end and it may not open any new connections to database after that.If process can be forcibly killed, it would be better not to use an embedded database in it, in that case a standalone H2 Server process, possibly launched as a system service, should be used.
Your issue also looks like duplicate of #2752, it was fixed in H2 2.3.230.
manticore-projects commentedon Jul 23, 2024
Greetings,
please retry with the latest GitHub Source, since 224 release quite some issues regarding such corruption have been fixed.
@katzyn @andreitokar @grandinj If you agree I would go through the open issues and close any corruption related ticket prior 230. I think at this point re-opening would be necessary if really anything was left over after your fixes. Do you agree and shall we?
manticore-projects commentedon Jul 23, 2024
Closing as: Please retry with latest source as its likely fixed and come back only when still observable with latest source compilation.