Update statements sometimes throws exception

64 views
Skip to first unread message

Steve McLeod

unread,
Oct 3, 2009, 5:46:59 AM10/3/09
to H2 Database
Hi,

I'm using 1.119, with the following database connection URL:
jdbc:h2:/Users/steve/Library/Application Support/Poker Copilot/
database/
pokercopilot;DATABASE_EVENT_LISTENER='com.barbarysoftware.pokercopilot.database.DatabaseListener';MAX_LENGTH_INPLACE_LOB=65536;DB_CLOSE_ON_EXIT=FALSE;COMPRESS_LOB=DEFLATE;LOG=2

This statement:
update GamePlayerSummary set buyin=20 where tournamentid=20
throws the following:

org.h2.jdbc.JdbcSQLException: General error:
java.lang.ArrayIndexOutOfBoundsException: 2096; SQL statement:
update GamePlayerSummary set buyin=? where tournamentid=? [50000-119]
at org.h2.message.Message.getSQLException(Message.java:106)
at org.h2.message.Message.convert(Message.java:283)
at org.h2.command.Command.executeUpdate(Command.java:228)
at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal
(JdbcPreparedStatement.java:139)
at org.h2.jdbc.JdbcPreparedStatement.executeUpdate
(JdbcPreparedStatement.java:128)
at org.springframework.jdbc.core.JdbcTemplate
$2.doInPreparedStatement(JdbcTemplate.java:798)
at org.springframework.jdbc.core.JdbcTemplate.execute
(JdbcTemplate.java:591)
at org.springframework.jdbc.core.JdbcTemplate.update
(JdbcTemplate.java:792)
at org.springframework.jdbc.core.JdbcTemplate.update
(JdbcTemplate.java:850)
at org.springframework.jdbc.core.JdbcTemplate.update
(JdbcTemplate.java:858)
at
org.springframework.jdbc.core.simple.SimpleJdbcTemplate.update
(SimpleJdbcTemplate.java:237)
at
com.barbarysoftware.pokercopilot.database.SimpleJdbcTemplateWrapper.update
(SimpleJdbcTemplateWrapper.java:275)
at
com.barbarysoftware.pokercopilot.database.HandAdderer.addTournamentSummary
(HandAdderer.java:179)
at com.barbarysoftware.pokercopilot.parser.TournamentParsedData
$1.run(TournamentParsedData.java:30)
at java.util.concurrent.Executors$RunnableAdapter.call
(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun
(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2096
at org.h2.store.DataPage.writeInt(DataPage.java:141)
at org.h2.result.RowList.writeRow(RowList.java:62)
at org.h2.result.RowList.writeAllRows(RowList.java:106)
at org.h2.result.RowList.add(RowList.java:137)
at org.h2.command.dml.Update.update(Update.java:118)
at org.h2.command.CommandContainer.update
(CommandContainer.java:72)
at org.h2.command.Command.executeUpdate(Command.java:208)
... 17 more

buyin and tournamentid are both ints.

This only happens for certain values of tournamentid. If I delete the
database, create it and populate it again, I'll sometimes still have
these problems but for other values of tournamentid.

I can supply my database with this problem, if it helps. It is 31 MB
compressed.

Regards,

Steve McLeod

Steve McLeod

unread,
Oct 3, 2009, 9:31:36 AM10/3/09
to H2 Database
Some more info: I've been testing whether this problem occurs with
1.118. After deleting, recreating, and repopulating the database 10
times with 1.118, I have not been able to reproduce it. There is a
high probability that this is a regression in 1.119...

Regards,

Steve

Steve McLeod

unread,
Oct 4, 2009, 6:09:02 AM10/4/09
to H2 Database
One more piece of info:

I created a database with the 1.119 jar. I got the exception I
described in the original post.

I then changed to the 1.118 jar, and using the database created with
1.119, I tried to execute the update statement again. It worked. I'm
quite relieved that the database itself is not corrupted!

Regards,

Steve

Thomas Mueller

unread,
Oct 5, 2009, 5:26:23 PM10/5/09
to h2-da...@googlegroups.com
Hi

Large updates are buffered to disk (to a temporary file). When writing
/ reading this file, the internal buffer size was too small sometimes.
This problem is fixed in version 1.2.120 (class RowList). I didn't
notice it was a bug, I fixed it as a side effect of another change in
this class. That's why the problem was not include it in the change
log. I will add it to the change log of version 1.2.120: "Large
updates could throw an ArrayIndexOutOfBoundsException in
RowList.writeRow"

Regards,
Thomas

Thomas Mueller

unread,
Oct 5, 2009, 5:29:36 PM10/5/09
to h2-da...@googlegroups.com
Hi,

You are right, this was a regression, the bug was introduced in
version 1.1.119 (at 2009-09-17 to be exact).

Regards,
Thomas

Brian

unread,
Oct 6, 2009, 1:20:23 AM10/6/09
to H2 Database
I've observed this as well - I thought I was nuts. - I still haven't
found what about my data makes it croak like that. I'll go back to
1.18 and see if that resolves it.
Reply all
Reply to author
Forward
0 new messages