H2 - 一般错误:“java.util.ConcurrentModificationException”[50000-188]

时间:2015-09-15 09:49:10

标签: h2

我们在框中使用H2作为数据库。 我们使用文件系统来保存我们的数据。

在过去的几天里一切正常,没有明显的理由我们得到这个例外:

org.h2.message.DbException: General error: "java.util.ConcurrentModificationException" [50000-188]
    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:94)
    at org.h2.mvstore.MVStore.writeInBackground(MVStore.java:2479)
    at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2689)
Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.util.ConcurrentModificationException" [50000-188]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    ... 5 more
Caused by: java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:894)
    at java.util.HashMap$ValueIterator.next(HashMap.java:922)
    at org.h2.mvstore.MVStore.applyFreedSpace(MVStore.java:1474)
    at org.h2.mvstore.MVStore.storeNowTry(MVStore.java:1126)
    at org.h2.mvstore.MVStore.storeNow(MVStore.java:1046)
    at org.h2.mvstore.MVStore.commitAndSave(MVStore.java:1035)
    at org.h2.mvstore.MVStore.writeInBackground(MVStore.java:2476)
    ... 1 more

在此异常之后,对数据库的所有请求都会抛出此异常:

java.sql.SQLException: Unable to run insert stmt on object DoorOpening{start=2015-09-14T18:20:32.932+02:00, end=null, device=Device{id=1601138, type=DOOR_MAGNET_SENSOR, whereInstalled=Room{id=406, label=entree principale, type=OTHER}}, readyToSend=false, sent=false}: INSERT INTO `door_opening` (`device` ,`start` ,`end` ,`readyToSend` ,`sent` ) VALUES (?,?,?,?,?)
    at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:22) ~[ormlite-core-4.48.jar:na]
    at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:135) ~[ormlite-core-4.48.jar:na]
    at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:450) ~[ormlite-core-4.48.jar:na]
    at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:310) ~[ormlite-core-4.48.jar:na]
    at com.krgcorporate.box.persistence.DatabaseManagerImpl.createDoorOpening(DatabaseManagerImpl.java:385) ~[persistence-0.1.jar:na]
    at com.krgcorporate.box.core.detection.event.DoorOpeningManagerImpl.open(DoorOpeningManagerImpl.java:92) ~[core-0.1.jar:na]
    at com.krgcorporate.box.core.detection.event.DoorOpeningManagerImpl.onRfIsmMessage(DoorOpeningManagerImpl.java:72) ~[core-0.1.jar:na]
    at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source) ~[na:na]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
    at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-18.0.jar:na]
    at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-18.0.jar:na]
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-18.0.jar:na]
    at com.google.common.eventbus.AsyncEventBus.access$001(AsyncEventBus.java:34) ~[guava-18.0.jar:na]
    at com.google.common.eventbus.AsyncEventBus$1.run(AsyncEventBus.java:117) ~[guava-18.0.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25]
    at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: org.h2.jdbc.JdbcSQLException: The database has been closed [90098-188]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.message.DbException.get(DbException.java:179) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.message.DbException.get(DbException.java:155) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.message.DbException.get(DbException.java:144) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.engine.Session.getTransaction(Session.java:1451) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.engine.Session.getStatementSavepoint(Session.java:1461) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.engine.Session.setSavepoint(Session.java:690) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.command.Command.executeUpdate(Command.java:248) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:157) ~[h2-1.4.188.jar:1.4.188]
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:143) ~[h2-1.4.188.jar:1.4.188]
    at com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:170) ~[ormlite-jdbc-4.48.jar:na]
    at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91) ~[ormlite-core-4.48.jar:na]
    ... 16 common frames omitted

hdd未满。 只使用1个连接访问数据库,该框不会产生大量插入。

提前感谢您的帮助。

0 个答案:

没有答案