2.2.220: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]

461 views
Skip to first unread message

t603

unread,
Aug 18, 2023, 2:53:31 PM8/18/23
to H2 Database
Hello,

I am facing the error posted below, when I run my code on H2 2.2.220. When I run the same code with 2.1.214, everything is fine, while with 2.2.220 it always fails on the same error.

It is set of batch SQL scripts, quite large and complex ones over complex set of data with no user interaction.

Luckily the database is created each run from scratch from set of external data sources, so I have no production problem.

I have noticed, that the same problem has TheRayvel https://groups.google.com/g/h2-database/c/cfw6d4wSoUU/m/cpsT7NMcBgAJ and Jurgen Pingel in https://groups.google.com/g/h2-database/c/cfw6d4wSoUU/m/3s_BHRP7AQAJ

Thank You in advance for Your help, Stepan

2023-08-18 18:52:49 database: flush
org.h2.message.DbException: General error: "org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]" [50000-220]
at org.h2.message.DbException.get(DbException.java:212)
at org.h2.message.DbException.convert(DbException.java:407)
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122)
at org.h2.mvstore.MVStore.handleException(MVStore.java:1547)
at org.h2.mvstore.MVStore.panic(MVStore.java:371)
at org.h2.mvstore.MVStore.tryExecuteUnderStoreLock(MVStore.java:940)
at org.h2.mvstore.RandomAccessStore.doHousekeeping(RandomAccessStore.java:721)
at org.h2.mvstore.FileStore.writeInBackground(FileStore.java:1838)
at org.h2.mvstore.FileStore$BackgroundWriterThread.run(FileStore.java:2249)
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]" [50000-220]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
... 9 more
Caused by: org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
at org.h2.mvstore.Page.read(Page.java:590)
at org.h2.mvstore.Page.read(Page.java:262)
at org.h2.mvstore.FileStore.readPage(FileStore.java:1969)
at org.h2.mvstore.MVStore.readPage(MVStore.java:1022)
at org.h2.mvstore.MVMap.readPage(MVMap.java:632)
at org.h2.mvstore.MVMap.rewritePage(MVMap.java:682)
at org.h2.mvstore.FileStore.rewriteChunks(FileStore.java:1921)
at org.h2.mvstore.FileStore.compactRewrite(FileStore.java:1897)
at org.h2.mvstore.FileStore.rewriteChunks(FileStore.java:1858)
at org.h2.mvstore.RandomAccessStore.lambda$doHousekeeping$4(RandomAccessStore.java:726)
at org.h2.mvstore.MVStore.tryExecuteUnderStoreLock(MVStore.java:938)
... 3 more
2023-08-18 18:52:49 jdbc[3]: exception
org.h2.jdbc.JdbcSQLNonTransientException: General error: "General error: ""org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]"" [50000-220]"; SQL statement:
 
create force local temporary linked table
  "TEMP"."linked.INT.xxx.xxx" (
    @myDriver
    ,@int_xxx_JDBC_URL
    ,coalesce(@int_xxx_JDBC_USERNAME, @YourDb2UserName_JDBC_USERNAME)
    ,coalesce(@int_xxx_JDBC_PASSWORD, @YourDb2Password_JDBC_PASSWORD)
    ,'(select "xxx", "xxx", "xxx", "xxx", "xxx", "xxx" from "' || 'xxx' || '"."xxx" where 1 = 1)'
  ) readonly
 [50000-220]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
at org.h2.message.DbException.get(DbException.java:212)
at org.h2.engine.Database.throwLastBackgroundException(Database.java:1783)
at org.h2.engine.SessionLocal.beforeCommitOrRollback(SessionLocal.java:760)
at org.h2.engine.SessionLocal.commit(SessionLocal.java:674)
at org.h2.command.Command.commitIfNonTransactional(Command.java:309)
at org.h2.command.Command.stop(Command.java:156)
at org.h2.command.CommandContainer.stop(CommandContainer.java:260)
at org.h2.command.Command.executeUpdate(Command.java:293)
at org.h2.command.dml.RunScriptCommand.execute(RunScriptCommand.java:120)
at org.h2.command.dml.RunScriptCommand.update(RunScriptCommand.java:71)
at org.h2.command.CommandContainer.update(CommandContainer.java:169)
at org.h2.command.Command.executeUpdate(Command.java:252)
at org.h2.command.dml.RunScriptCommand.execute(RunScriptCommand.java:120)
at org.h2.command.dml.RunScriptCommand.update(RunScriptCommand.java:71)
at org.h2.command.CommandContainer.update(CommandContainer.java:169)
at org.h2.command.Command.executeUpdate(Command.java:252)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:252)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:223)
at org.h2.tools.RunScript.process(RunScript.java:255)
at org.h2.tools.RunScript.process(RunScript.java:186)
at org.h2.tools.RunScript.process(RunScript.java:313)
at org.h2.tools.RunScript.runTool(RunScript.java:139)
at org.h2.tools.RunScript.main(RunScript.java:66)
Caused by: org.h2.message.DbException: General error: "org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]" [50000-220]
at org.h2.message.DbException.get(DbException.java:212)
at org.h2.message.DbException.convert(DbException.java:407)
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:122)
at org.h2.mvstore.MVStore.handleException(MVStore.java:1547)
at org.h2.mvstore.MVStore.panic(MVStore.java:371)
at org.h2.mvstore.MVStore.tryExecuteUnderStoreLock(MVStore.java:940)
at org.h2.mvstore.RandomAccessStore.doHousekeeping(RandomAccessStore.java:721)
at org.h2.mvstore.FileStore.writeInBackground(FileStore.java:1838)
at org.h2.mvstore.FileStore$BackgroundWriterThread.run(FileStore.java:2249)
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]" [50000-220]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
... 9 more
Caused by: org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
at org.h2.mvstore.Page.read(Page.java:590)
at org.h2.mvstore.Page.read(Page.java:262)
at org.h2.mvstore.FileStore.readPage(FileStore.java:1969)
at org.h2.mvstore.MVStore.readPage(MVStore.java:1022)
at org.h2.mvstore.MVMap.readPage(MVMap.java:632)
at org.h2.mvstore.MVMap.rewritePage(MVMap.java:682)
at org.h2.mvstore.FileStore.rewriteChunks(FileStore.java:1921)
at org.h2.mvstore.FileStore.compactRewrite(FileStore.java:1897)
at org.h2.mvstore.FileStore.rewriteChunks(FileStore.java:1858)
at org.h2.mvstore.RandomAccessStore.lambda$doHousekeeping$4(RandomAccessStore.java:726)
at org.h2.mvstore.MVStore.tryExecuteUnderStoreLock(MVStore.java:938)
... 3 more
2023-08-18 18:52:50 jdbc[3]: exception
org.h2.jdbc.JdbcSQLNonTransientConnectionException: The database has been closed [90098-220]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:690)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
at org.h2.message.DbException.get(DbException.java:212)
at org.h2.engine.SessionLocal.getTransaction(SessionLocal.java:1606)
at org.h2.mvstore.db.MVPrimaryIndex.getMap(MVPrimaryIndex.java:391)
at org.h2.mvstore.db.MVPrimaryIndex.find(MVPrimaryIndex.java:369)
at org.h2.mvstore.db.MVPrimaryIndex.find(MVPrimaryIndex.java:235)
at org.h2.mvstore.db.MVDelegateIndex.find(MVDelegateIndex.java:88)
at org.h2.engine.Database.removeMeta(Database.java:836)
at org.h2.table.Table.removeChildrenAndResources(Table.java:612)
at org.h2.table.TableLink.removeChildrenAndResources(TableLink.java:600)
at org.h2.engine.SessionLocal.cleanTempTables(SessionLocal.java:982)
at org.h2.engine.SessionLocal.close(SessionLocal.java:897)
at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:360)
at org.h2.tools.RunScript.process(RunScript.java:314)
at org.h2.tools.RunScript.runTool(RunScript.java:139)
at org.h2.tools.RunScript.main(RunScript.java:66)
Caused by: org.h2.mvstore.MVStoreException: File corrupted in chunk 17, expected page length 4..1536, got -1711276031 [2.2.220/6]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
at org.h2.mvstore.Page.read(Page.java:590)
at org.h2.mvstore.Page.read(Page.java:262)
at org.h2.mvstore.FileStore.readPage(FileStore.java:1969)
at org.h2.mvstore.MVStore.readPage(MVStore.java:1022)
at org.h2.mvstore.MVMap.readPage(MVMap.java:632)
at org.h2.mvstore.MVMap.rewritePage(MVMap.java:682)
at org.h2.mvstore.FileStore.rewriteChunks(FileStore.java:1921)
at org.h2.mvstore.FileStore.compactRewrite(FileStore.java:1897)
at org.h2.mvstore.FileStore.rewriteChunks(FileStore.java:1858)
at org.h2.mvstore.RandomAccessStore.lambda$doHousekeeping$4(RandomAccessStore.java:726)
at org.h2.mvstore.MVStore.tryExecuteUnderStoreLock(MVStore.java:938)
at org.h2.mvstore.RandomAccessStore.doHousekeeping(RandomAccessStore.java:721)
at org.h2.mvstore.FileStore.writeInBackground(FileStore.java:1838)
at org.h2.mvstore.FileStore$BackgroundWriterThread.run(FileStore.java:2249)

Andrei Tokar

unread,
Aug 22, 2023, 10:36:52 AM8/22/23
to H2 Database
Hi t603,
I think I have a fix for corruption problem, but since I can not reproduce it myself, and you are claiming that you have a reproducible test case, it will be extremely helpful if you can build H2 from master branch, as outlined here and confirm the fix (or not), so we can accordingly plan the patch or keep digging.
If you, on the other hand, can share your test case with mangled data (if sensitive), that would be even better, especially if my fix is not good enough.
--
Thank You,
Andrei Tokar

t603

unread,
Aug 22, 2023, 2:01:53 PM8/22/23
to H2 Database
Hi, Andrei, 
You are great, You have fixed the problem! I have built the h2-2.2.229-SNAPSHOT.jar with Adoptium OpenJDK 17 (the same Java, which I use for my app), run my code twice and it works both times without error!
Unfortunately I can not share data, because all data are taken runtime from external linked tables mostly to another databases and from CSV and JSON a XML datasources. 
Thank You very much, Stepan 

Dne úterý 22. srpna 2023 v 16:36:52 UTC+2 uživatel Andrei Tokar napsal:

Andrei Tokar

unread,
Aug 22, 2023, 6:50:51 PM8/22/23
to H2 Database
Thanks a lot t603 for a quick turnaround. Since it fixes your issue, test case is not really needed, Now we are good to issue a new release.
-- Andrei

t603

unread,
Aug 23, 2023, 6:37:27 AM8/23/23
to H2 Database
Hi, Andrei, I run my code just now with h2-2.2.222.jar released yesterday evening for public and I can confirm, that it works OK without any error. Thank You again, Stepan 

Dne středa 23. srpna 2023 v 0:50:51 UTC+2 uživatel Andrei Tokar napsal:
Reply all
Reply to author
Forward
0 new messages