Thomas, Thanks for your quick reply. I am not 100% certain that I could reproduce my first issue, However, I downloaded and tested 1.4.179 under the same conditions. One connection, multiple threads updating rows ( currently my methods are all synchronized, but they were before as well. ).
I have run for approx 13 hours with approx 400K inserts and approx 1M updates - no problems, issues, or trace file produced. Looks good. Thanks. On Monday, June 23, 2014 3:09:01 PM UTC-4, Thomas Mueller wrote: > > Hi, > > Could you try again with H2 version 1.4.179 please? (You are currently > using 1.4.178.) If it's still a problem, could you send me the test case so > I can try to reproduce the problem? > > > The documentation says that multi-threading is safe ... > > Wit H2: yes. > > > ... and that applications do not need to worry about synchronizing > access. But it also says that "an application should normally use one > connection per thread". These seem to be contradicting statements. > > "This database synchronizes access to the same connection, *but other > databases may not do this.*" > > Regards, > Thomas > > > > On Mon, Jun 23, 2014 at 8:08 PM, Kenton Garner <[email protected] > <javascript:>> wrote: > >> The documentation says that multi-threading is safe and that >> applications do not need to worry about synchronizing access. But it also >> says that "an application should normally use one connection per thread". >> These seem to be contradicting statements. >> I have recently run a test with one connection with synchronized access >> and after about 20 minutes of updates the database threw the following >> exception (copied from trace file)... >> >> >> 06-20 23:01:39 database: flush >> org.h2.message.DbException: General error: >> "java.lang.IndexOutOfBoundsException: Index: 1, Size: 2" [50000-178] >> at org.h2.message.DbException.get(DbException.java:167) >> at org.h2.message.DbException.convert(DbException.java:294) >> at >> org.h2.mvstore.db.MVTableEngine$1.uncaughtException(MVTableEngine.java:89) >> at org.h2.mvstore.MVStore.commitInBackground(MVStore.java:2192) >> at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2377) >> Caused by: org.h2.jdbc.JdbcSQLException: General error: >> "java.lang.IndexOutOfBoundsException: Index: 1, Size: 2" [50000-178] >> at org.h2.message.DbException.getJdbcSQLException(DbException.java:344) >> ... 5 more >> Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 2 >> at java.util.ArrayList.rangeCheck(ArrayList.java:635) >> at java.util.ArrayList.get(ArrayList.java:411) >> at org.h2.mvstore.MVMap.searchRoot(MVMap.java:1130) >> at org.h2.mvstore.MVMap.removeUnusedOldVersions(MVMap.java:919) >> at org.h2.mvstore.MVStore.revertTemp(MVStore.java:2073) >> at org.h2.mvstore.MVStore.storeNow(MVStore.java:1072) >> at org.h2.mvstore.MVStore.commitAndSave(MVStore.java:918) >> at org.h2.mvstore.MVStore.commitInBackground(MVStore.java:2189) >> ... 1 more >> >> >> I cannot find much on this, but I did find one similar exception >> reference and Thomas assumed it was a multi-threaded issue. >> >> That being said, does anyone have any ideas as to whether a connection >> pool would solve this problem. I do not know if it is repeatable. >> >> I changed my code to do a quick and dirty one connection per thread and >> ran for a day and half without issue, but I would prefer only one embedded >> connection versus a mixture. >> >> *connection URL: >> "jdbc:h2:audit;AUTOCOMMIT=ON;MVCC=TRUE;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=8700" >> >> * >> >> From documentation: >> >>> *Multithreading Support* >>> >>> This database is multithreading-safe. That means, if an application is >>> multi-threaded, it does not need to worry about synchronizing access to the >>> database. Internally, most requests to the same database are synchronized. >>> That means an application can use multiple threads that access the same >>> database at the same time, however if one thread executes a long running >>> query, the other threads need to wait. >>> An application should normally use one connection per thread. This >>> database synchronizes access to the same connection, but other databases >>> may not do this. >> >> -- >> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
