H2 corrupted DB

2,976 views
Skip to first unread message

Osvaldas Ziukas

unread,
Apr 29, 2015, 7:38:49 AM4/29/15
to h2-da...@googlegroups.com
This happend with newest H2 version i got and updated programs. h2-1.4.187.jar

In 3 Days i renewed ~200 client programs, same happend to at least 5


04-28 16:53:35 database: flush
org.h2.message.DbException: General error: "java.lang.IllegalStateException: Reading from cache:nio:/home/gmps/mobile/database/localDb_v3.66.mv.db failed; file length 589824 read length 384 at 639611 [1.4.187/1]" [50000-187]
        at org.h2.message.DbException.get(DbException.java:168)
        at org.h2.message.DbException.convert(DbException.java:295)
        at org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:93)
        at org.h2.mvstore.MVStore.panic(MVStore.java:368)
        at org.h2.mvstore.MVStore.<init>(MVStore.java:351)
        at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2782)
        at org.h2.mvstore.db.MVTableEngine$Store.<init>(MVTableEngine.java:162)
        at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:98)
        at org.h2.engine.Database.getPageStore(Database.java:2389)
        at org.h2.engine.Database.open(Database.java:669)
        at org.h2.engine.Database.openDatabase(Database.java:266)
        at org.h2.engine.Database.<init>(Database.java:260)
        at org.h2.engine.Engine.openSession(Engine.java:60)
        at org.h2.engine.Engine.openSession(Engine.java:167)
        at org.h2.engine.Engine.createSessionAndValidate(Engine.java:145)
        at org.h2.engine.Engine.createSession(Engine.java:128)
        at org.h2.engine.Engine.createSession(Engine.java:26)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:347)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:108)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:92)
        at org.h2.Driver.connect(Driver.java:72)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at lt.dekbera.mobileClient.model.dBservice.H2localDb.connectToDB(H2localDb.java:981)
        at lt.dekbera.mobileClient.model.dBservice.H2localDb.connectToDB(H2localDb.java:987)
        at lt.dekbera.mobileClient.model.dBservice.H2localDb.<init>(H2localDb.java:40)
        at lt.dekbera.mobileClient.DataManager.<init>(DataManager.java:103)
        at lt.dekbera.mobileClient.MobileClientUIService.initNewModules(MobileClientUIService.java:525)
        at lt.dekbera.mobileClient.MobileClientUIService.<init>(MobileClientUIService.java:72)
        at lt.dekbera.mobileClient.MobileClient.initService(MobileClient.java:64)
        at lt.dekbera.mobileClient.MobileClient.start(MobileClient.java:44)
        at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$5.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl$4$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
        at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at com.sun.glass.ui.gtk.GtkApplication$3$1.run(Unknown Source)

Thomas Mueller

unread,
Apr 29, 2015, 2:37:19 PM4/29/15
to h2-da...@googlegroups.com
Hi,

The database is trying to read past the end of the file... Would it be possible to send me the database file to investigate?

Regards,
Thomas
--
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 post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Osvaldas Ziukas

unread,
Apr 29, 2015, 6:26:20 PM4/29/15
to h2-da...@googlegroups.com
Hello here is db file
localDb_v3.66.mv.db

Thomas Mueller

unread,
May 5, 2015, 1:45:59 AM5/5/15
to h2-da...@googlegroups.com
Hi,

That's strange. The last part of the file is missing.

Looking at the H2 source code, the file truncate code is very simple and conservative (MVStore.shrinkFileIfPossible, which is calling getFileLengthInUse). It looks unlikely that there is a bug in this area.

Could you describe what you did to get into this state? One possible way to get into this situation is to copy the database file while it is in use, without using the online backup command. Or truncate the file in some other way. Other than that, I wouldn't know a way. Do you have a reproducible test case?

Regards
Thomas

On Thursday, April 30, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:
Hello here is db file

Osvaldas Ziukas

unread,
May 5, 2015, 2:50:34 AM5/5/15
to h2-da...@googlegroups.com


2015 m. gegužė 5 d., antradienis 08:45:59 UTC+3, Thomas Mueller rašė:
Hi,

That's strange. The last part of the file is missing.

Looking at the H2 source code, the file truncate code is very simple and conservative (MVStore.shrinkFileIfPossible, which is calling getFileLengthInUse). It looks unlikely that there is a bug in this area.

Could you describe what you did to get into this state? One possible way to get into this situation is to copy the database file while it is in use, without using the online backup command. Or truncate the file in some other way. Other than that, I wouldn't know a way. Do you have a reproducible test case?

Regards
Thomas

On Thursday, April 30, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:
Hello here is db file

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Sadly no, we use H2 database in our aplications and this issue happens sometimes, first appearance noticed after half an year of work. As far as i know no one copy modify of effect db and it happens during h2 use. Only effects who can reduce size of db are old records delete by id, nothing else. 

Thomas Mueller

unread,
Oct 15, 2015, 11:50:09 AM10/15/15
to h2-da...@googlegroups.com
Hi,

FYI this problem is fixed since version 1.4.188. The problem was that if writes were re-ordered, and a power failure occurred, truncate was sometimes done before a previous write.

Regards,
Thomas


On Tuesday, May 5, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:


2015 m. gegužė 5 d., antradienis 08:45:59 UTC+3, Thomas Mueller rašė:
Hi,

That's strange. The last part of the file is missing.

Looking at the H2 source code, the file truncate code is very simple and conservative (MVStore.shrinkFileIfPossible, which is calling getFileLengthInUse). It looks unlikely that there is a bug in this area.

Could you describe what you did to get into this state? One possible way to get into this situation is to copy the database file while it is in use, without using the online backup command. Or truncate the file in some other way. Other than that, I wouldn't know a way. Do you have a reproducible test case?

Regards
Thomas

On Thursday, April 30, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:
Hello here is db file

--
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 post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Sadly no, we use H2 database in our aplications and this issue happens sometimes, first appearance noticed after half an year of work. As far as i know no one copy modify of effect db and it happens during h2 use. Only effects who can reduce size of db are old records delete by id, nothing else. 

--
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.

Alex. Sun

unread,
Jan 30, 2016, 10:25:11 AM1/30/16
to H2 Database
Hi,

I have the same problem with version 1.4.190, any suggestion?

在 2015年10月15日星期四 UTC+8下午11:50:09,Thomas Mueller写道:
Hi,

FYI this problem is fixed since version 1.4.188. The problem was that if writes were re-ordered, and a power failure occurred, truncate was sometimes done before a previous write.

Regards,
Thomas


On Tuesday, May 5, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:


2015 m. gegužė 5 d., antradienis 08:45:59 UTC+3, Thomas Mueller rašė:
Hi,

That's strange. The last part of the file is missing.

Looking at the H2 source code, the file truncate code is very simple and conservative (MVStore.shrinkFileIfPossible, which is calling getFileLengthInUse). It looks unlikely that there is a bug in this area.

Could you describe what you did to get into this state? One possible way to get into this situation is to copy the database file while it is in use, without using the online backup command. Or truncate the file in some other way. Other than that, I wouldn't know a way. Do you have a reproducible test case?

Regards
Thomas

On Thursday, April 30, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:
Hello here is db file

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Sadly no, we use H2 database in our aplications and this issue happens sometimes, first appearance noticed after half an year of work. As far as i know no one copy modify of effect db and it happens during h2 use. Only effects who can reduce size of db are old records delete by id, nothing else. 

--
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+unsubscribe@googlegroups.com.

Vasil Stoynev

unread,
Apr 21, 2017, 5:56:01 AM4/21/17
to H2 Database

Hi,

unfortunately the problem seems to persist.

Happened with v. 1.4.193 and MVStore. Root cause is java.io.EOFException at org.h2.mvstore.DataUtils.readFully(DataUtils.java:423).


Greetings,
Vasil


On Thursday, October 15, 2015 at 6:50:09 PM UTC+3, Thomas Mueller Graf wrote:
Hi,

FYI this problem is fixed since version 1.4.188. The problem was that if writes were re-ordered, and a power failure occurred, truncate was sometimes done before a previous write.

Regards,
Thomas


On Tuesday, May 5, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:


2015 m. gegužė 5 d., antradienis 08:45:59 UTC+3, Thomas Mueller rašė:
Hi,

That's strange. The last part of the file is missing.

Looking at the H2 source code, the file truncate code is very simple and conservative (MVStore.shrinkFileIfPossible, which is calling getFileLengthInUse). It looks unlikely that there is a bug in this area.

Could you describe what you did to get into this state? One possible way to get into this situation is to copy the database file while it is in use, without using the online backup command. Or truncate the file in some other way. Other than that, I wouldn't know a way. Do you have a reproducible test case?

Regards
Thomas

On Thursday, April 30, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:
Hello here is db file

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Sadly no, we use H2 database in our aplications and this issue happens sometimes, first appearance noticed after half an year of work. As far as i know no one copy modify of effect db and it happens during h2 use. Only effects who can reduce size of db are old records delete by id, nothing else. 

--
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+unsubscribe@googlegroups.com.
Message has been deleted

gana joe

unread,
Jan 4, 2018, 3:18:58 AM1/4/18
to H2 Database
in h2-1.4.196.jar ,I also got this problem .

 2018-01-02 23:04:51 053 ->[RxCachedThreadScheduler-1]--[INFO ]--[Bus]--KnxRouter 上线,未曾上线设备
 2018-01-02 23:04:51 053 ->[RxCachedThreadScheduler-1]--[INFO ]--[Bus]--开始上线KNX设备
 2018-01-02 23:04:51 100 ->[RxCachedThreadScheduler-1]--[INFO ]--[Bus]--上线设备,physicalAddress = 5/1/1 ,mac = KX/5/1/1 ,channel = 1, type =COMMON LIGHT
 2018-01-02 23:04:51 116 ->[RxCachedThreadScheduler-1]--[ERROR]--[Bus]--cusume event error
 java.lang.IllegalStateException: Could not build lazy iterator for class com.moorgen.knx.bridge.knx.data.KnxDataPoint
	at com.j256.ormlite.dao.LazyForeignCollection.closeableIterator(LazyForeignCollection.java:72) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.iterator(LazyForeignCollection.java:54) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.toArray(LazyForeignCollection.java:213) ~[KnxMoorgenBridge.jar:?]
	at java.util.ArrayList.<init>(Unknown Source) ~[?:1.8.0_144]
	at com.moorgen.knx.bridge.knx.data.KnxDevice.getDatapoints(KnxDevice.java:120) ~[KnxMoorgenBridge.jar:?]
	at com.moorgen.knx.bridge.bus.Bus.onlineKnxDevices(Bus.java:154) ~[KnxMoorgenBridge.jar:?]
	at com.moorgen.knx.bridge.bus.Bus.lambda$startMessageEventLoop$0(Bus.java:108) ~[KnxMoorgenBridge.jar:?]
	at io.reactivex.internal.subscribers.LambdaSubscriber.onNext(LambdaSubscriber.java:61) [KnxMoorgenBridge.jar:?]
	at io.reactivex.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(FlowableObserveOn.java:399) [KnxMoorgenBridge.jar:?]
	at io.reactivex.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:175) [KnxMoorgenBridge.jar:?]
	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:59) [KnxMoorgenBridge.jar:?]
	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:51) [KnxMoorgenBridge.jar:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_144]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:1.8.0_144]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_144]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_144]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_144]
Caused by: java.sql.SQLException: Could not build prepared-query iterator for class com.moorgen.knx.bridge.knx.data.KnxDataPoint
	at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.BaseDaoImpl.createIterator(BaseDaoImpl.java:1102) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.BaseDaoImpl.iterator(BaseDaoImpl.java:608) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.seperateIteratorThrow(LazyForeignCollection.java:309) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.iteratorThrow(LazyForeignCollection.java:83) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.closeableIterator(LazyForeignCollection.java:70) ~[KnxMoorgenBridge.jar:?]
	... 17 more
Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: Reading from nio:D:/KnxMoorgenBridge/KnxMoorgenBridge/2017_12_07/bin/devices.mv.db failed; file length 520192 read length 256 at 528630 [1.4.196/1]"; SQL statement:
SELECT * FROM `knx_datapoints` WHERE `device_no` = ?  [50000-196]
	at org.h2.engine.SessionRemote.done(SessionRemote.java:629) ~[KnxMoorgenBridge.jar:?]
	at org.h2.command.CommandRemote.executeQuery(CommandRemote.java:176) ~[KnxMoorgenBridge.jar:?]
	at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:111) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.jdbc.JdbcCompiledStatement.runQuery(JdbcCompiledStatement.java:63) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.stmt.SelectIterator.<init>(SelectIterator.java:57) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:247) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.BaseDaoImpl.createIterator(BaseDaoImpl.java:1098) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.BaseDaoImpl.iterator(BaseDaoImpl.java:608) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.seperateIteratorThrow(LazyForeignCollection.java:309) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.iteratorThrow(LazyForeignCollection.java:83) ~[KnxMoorgenBridge.jar:?]
	at com.j256.ormlite.dao.LazyForeignCollection.closeableIterator(LazyForeignCollection.java:70) ~[KnxMoorgenBridge.jar:?]

Ayush Mathur

unread,
Oct 17, 2018, 1:36:36 PM10/17/18
to H2 Database
Hi,

Is there any update on this issue, we are facing same problem with H2 version 1.4.196 ? It looks like some CTE NPE issues were resolved in 1.4.197: https://github.com/h2database/h2database/issues/645

Meni Hillel

unread,
Jun 22, 2019, 8:16:13 PM6/22/19
to H2 Database
@Thomas Mueller - You mentioned that file corruption may take place if "copy the database file while it is in use, without using the online backup command". Can you please elaborate?

Do note that we do make a file copy while DB is in use, but we make a call to "SET EXCLUSIVE 1" before. What would be "online backup command" ? We want to have a full copy of the DB "as is", ready to go for backup/restore and even replicate it for HA. Is there a better way to achieve this?

I am hitting the same corruption issue. We were using 1.4.96 and not upgraded to 1.4.99. With 1.4.96, once hit, all threads failed and database was unusable. See exception we're hitting below:

org.hibernate.exception.GenericJDBCException: could not execute statement
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[factory.jar:1.4]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[factory.jar:1.4]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[factory.jar:1.4]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:211) ~[factory.jar:1.4]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3285) ~[factory.jar:1.4]
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3183) ~[factory.jar:1.4]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3525) ~[factory.jar:1.4]
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:159) ~[factory.jar:1.4]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:465) ~[factory.jar:1.4]
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:351) ~[factory.jar:1.4]
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) ~[factory.jar:1.4]
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) ~[factory.jar:1.4]
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1258) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.util.db.TransactionRunner.commit(TransactionRunner.java:129) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.util.db.TransactionRunner.commitIntent(TransactionRunner.java:202) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.manager.chassis.task.vmware.VmwareCreateMicroSegmentNetworkTask.executeTransaction(VmwareCreateMicroSegmentNetworkTask.java:98) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.job.task.TransactionalTask$1.run(TransactionalTask.java:48) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.util.db.TransactionRunner.exec(TransactionRunner.java:81) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.util.db.TransactionRunner.exec(TransactionRunner.java:73) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.job.task.TransactionalTask.lambda$execute$0(TransactionalTask.java:53) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.util.db.TransactionRetrier.tryAttempts(TransactionRetrier.java:49) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.util.db.TransactionRetrier.tryAttempts(TransactionRetrier.java:42) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.job.task.TransactionalTask.execute(TransactionalTask.java:41) ~[factory.jar:1.4]
at com.shieldxnetworks.factory.job.TaskNode.run(TaskNode.java:270) [factory.jar:1.4]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_152]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: IO Exception: "retry:/var/lib/factory/shieldxdb.mv.db"; SQL statement:
update port set version=?, cloud_object_id=?, connected=?, inspection_port_type=?, lb_fk=?, mac_address=?, micro_segment_network_fk=?, name=?, network_fk=?, original_network_fk=?, type=?, vm_fk=? where id=? and version=? [90028-199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) ~[factory.jar:1.4]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[factory.jar:1.4]
at org.h2.message.DbException.get(DbException.java:194) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVTableEngine$Store.convertIllegalStateException(MVTableEngine.java:197) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVTable.convertException(MVTable.java:725) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVSecondaryIndex.remove(MVSecondaryIndex.java:239) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVTable.removeRow(MVTable.java:514) ~[factory.jar:1.4]
at org.h2.table.Table.updateRows(Table.java:506) ~[factory.jar:1.4]
at org.h2.command.dml.Update.update(Update.java:203) ~[factory.jar:1.4]
at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[factory.jar:1.4]
at org.h2.command.Command.executeUpdate(Command.java:267) ~[factory.jar:1.4]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:200) ~[factory.jar:1.4]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:154) ~[factory.jar:1.4]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208) ~[factory.jar:1.4]
... 25 more
Caused by: java.lang.IllegalStateException: Reading from retry:/var/lib/factory/shieldxdb.mv.db failed; file length 607985664 read length 192 at 523398200 [1.4.199/1]
at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:883) ~[factory.jar:1.4]
at org.h2.mvstore.DataUtils.readFully(DataUtils.java:420) ~[factory.jar:1.4]
at org.h2.mvstore.FileStore.readFully(FileStore.java:98) ~[factory.jar:1.4]
at org.h2.mvstore.MVStore.readBufferForPage(MVStore.java:1048) ~[factory.jar:1.4]
at org.h2.mvstore.MVStore.readPage(MVStore.java:2186) ~[factory.jar:1.4]
at org.h2.mvstore.MVMap.readPage(MVMap.java:554) ~[factory.jar:1.4]
at org.h2.mvstore.Page$NonLeaf.getChildPage(Page.java:1086) ~[factory.jar:1.4]
at org.h2.mvstore.MVMap.traverseDown(MVMap.java:1877) ~[factory.jar:1.4]
at org.h2.mvstore.MVMap.operate(MVMap.java:1664) ~[factory.jar:1.4]
at org.h2.mvstore.tx.TransactionMap.set(TransactionMap.java:306) ~[factory.jar:1.4]
at org.h2.mvstore.tx.TransactionMap.set(TransactionMap.java:289) ~[factory.jar:1.4]
at org.h2.mvstore.tx.TransactionMap.remove(TransactionMap.java:209) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVSecondaryIndex.remove(MVSecondaryIndex.java:232) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVTable.removeRow(MVTable.java:514) ~[factory.jar:1.4]
at org.h2.table.Table.updateRows(Table.java:506) ~[factory.jar:1.4]
at org.h2.command.dml.Update.update(Update.java:203) ~[factory.jar:1.4]
at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[factory.jar:1.4]
at org.h2.command.Command.executeUpdate(Command.java:267) ~[factory.jar:1.4]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:200) ~[factory.jar:1.4]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:154) ~[factory.jar:1.4]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208) ~[factory.jar:1.4]
... 25 more
Caused by: java.io.EOFException
at org.h2.mvstore.DataUtils.readFully(DataUtils.java:408) ~[factory.jar:1.4]
at org.h2.mvstore.FileStore.readFully(FileStore.java:98) ~[factory.jar:1.4]
at org.h2.mvstore.MVStore.readBufferForPage(MVStore.java:1048) ~[factory.jar:1.4]
at org.h2.mvstore.MVStore.readPage(MVStore.java:2186) ~[factory.jar:1.4]
at org.h2.mvstore.MVMap.readPage(MVMap.java:554) ~[factory.jar:1.4]
at org.h2.mvstore.Page$NonLeaf.getChildPage(Page.java:1086) ~[factory.jar:1.4]
at org.h2.mvstore.MVMap.traverseDown(MVMap.java:1877) ~[factory.jar:1.4]
at org.h2.mvstore.MVMap.operate(MVMap.java:1664) ~[factory.jar:1.4]
at org.h2.mvstore.tx.TransactionMap.set(TransactionMap.java:306) ~[factory.jar:1.4]
at org.h2.mvstore.tx.TransactionMap.set(TransactionMap.java:289) ~[factory.jar:1.4]
at org.h2.mvstore.tx.TransactionMap.remove(TransactionMap.java:209) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVSecondaryIndex.remove(MVSecondaryIndex.java:232) ~[factory.jar:1.4]
at org.h2.mvstore.db.MVTable.removeRow(MVTable.java:514) ~[factory.jar:1.4]
at org.h2.table.Table.updateRows(Table.java:506) ~[factory.jar:1.4]
at org.h2.command.dml.Update.update(Update.java:203) ~[factory.jar:1.4]
at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[factory.jar:1.4]
at org.h2.command.Command.executeUpdate(Command.java:267) ~[factory.jar:1.4]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:200) ~[factory.jar:1.4]
at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:154) ~[factory.jar:1.4]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208) ~[factory.jar:1.4]
... 25 more

We do actually make a copy of the file, but we call SET EXCLUSIVE 1 before we do that. 



On Monday, May 4, 2015 at 10:45:59 PM UTC-7, Thomas Mueller wrote:
Hi,

That's strange. The last part of the file is missing.

Looking at the H2 source code, the file truncate code is very simple and conservative (MVStore.shrinkFileIfPossible, which is calling getFileLengthInUse). It looks unlikely that there is a bug in this area.

Could you describe what you did to get into this state? One possible way to get into this situation is to copy the database file while it is in use, without using the online backup command. Or truncate the file in some other way. Other than that, I wouldn't know a way. Do you have a reproducible test case?

Regards
Thomas

On Thursday, April 30, 2015, Osvaldas Ziukas <osvalda...@gmail.com> wrote:
Hello here is db file

--
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+unsubscribe@googlegroups.com.

Evgenij Ryazanov

unread,
Jun 22, 2019, 8:46:13 PM6/22/19
to H2 Database
We do actually make a copy of the file, but we call SET EXCLUSIVE 1 before we do that.
It does not matter, such copy may still be unusable. Database can write something in background and copy can read inconsistent older and newer data. If you really want to copy the file, you need to shutdown the database completely and somehow make sure that it will not be opened again while file is being copied.

The normal way for regular backup procedure is a BACKUP command:

Diego Rovere

unread,
Jul 23, 2019, 9:45:58 AM7/23/19
to H2 Database
@Thomas Mueller

I'm facing the same error with 1.4.199. The db is corrupted and the Recover tool is not capable to solve the problem. I would really appreciate a fix because the DB is a result of  long lasting analysis process.
Could you please help me telling me what could be the best approach to avoid this condition?
Thank you!

Paul Taylor

unread,
Jul 23, 2019, 10:26:21 AM7/23/19
to H2 Database

Diego Rovere

unread,
Jul 23, 2019, 10:36:08 AM7/23/19
to h2-da...@googlegroups.com
Thanks Paul, I don’t think so, I’m accessing the DB in server mode. The tcp server is no more capable to load the db, in fact also the web console returns a 90028-199 when trying to connect.
I read other threads and I saw that the Recover tool of the 197 version could recover the db. I tried and it seems to work, it generated the script. I still have to reimport it and inspect if at least the big part of the data has been recovered. Nevertheless I was trying to understand how to avoid such conditions. Are there any settings that could make the tcp server more stable and reliable?

Il giorno mar 23 lug 2019 alle 16:26 Paul Taylor <pault...@jthink.net> ha scritto:
--
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 on the web visit https://groups.google.com/d/msgid/h2-database/b463dd73-780c-43bf-948f-0e213726b93e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages