Hi Sam,

after deleting and inserting a large amount of rows (deleting 300 000
and after that writing 300 000 rows) (using  1.0.76 (2008-07-27) ) i
got a RuntimeException: freeCount expected in my Java program.

So i asked google with this problem and found the following thread:

http://groups.google.com/group/h2-database/browse_thread/thread/72ec33358d275b8a




// QUOTE

Hi,


> Caused by: java.lang.RuntimeException: freeCount expected 0, got: 448
>    at org/h2/message/Message.getInternalError (Message.java:179)
>    at org/h2/store/Storage.refillFreeList (Storage.java:247)
>    at org/h2/store/Storage.allocate (Storage.java:254)
>    at org/h2/store/Storage.addRecord (Storage.java:182)
>    at org/h2/index/ScanIndex.add (ScanIndex.java:123)
>    at org/h2/table/TableData.addRow (TableData.java:108)
>    ... 15 more

> Our jdbc url is:
> jdbc:h2:rundir\db
> \db;LOG=2;MAX_LOG_SIZE=1;DB_CLOSE_DELAY=-1;TRACE_MAX_FILE_SIZE=1,username=s­a,password=



Thanks! Unfortunately I couldn't reproduce this problem - do you have
a simple test case where this problem occurs?


> In another post here, it is mentioned that "It is not critical at
> runtime if freeCount is incorrect". So, is there a way to configure
> the database, so that this check is not performed (at least for the
> time being).


Yes, set the system property h2.check to false: java -Dh2.check=false
... or System.setProperty("h2.check", "false") before loading the
database driver.


> Also, is it possible for us to maybe detect this
> condition and somehow repair the database?


The database is not broken, there is no need to repair. It is
something in the code I like to fix.

Regards,
Thomas


// QUOTE


So i used this workaround in my program, to prohibit the runtime
exception...


After doing some tests, i got now a jeave heap exception or database
already closed error , after deleting and inserting a large amount of
rows.

01-05 10:36:37 jdbc[2]: SQLException
org.h2.jdbc.JdbcSQLException: Die Datenbank ist bereits geschlossen
The database has been closed [90098-126]
        at org.h2.message.Message.getSQLException(Message.java:110)
        at org.h2.message.Message.getSQLException(Message.java:121)
        at org.h2.message.Message.getSQLException(Message.java:74)
        at org.h2.message.Message.getSQLException(Message.java:156)
        at org.h2.engine.Database.checkPowerOff(Database.java:468)
        at org.h2.command.Command.executeUpdate(Command.java:227)
        at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:
124)
        at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:109)

...

        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)



If i use vmargs like:  -Xms256m -Xmx1024m this problem does not
appear.


wheres the mistake ? can i prohibit this without setting the memory
for the jvm ?

Cheers,

Reiner


On 5 Jan., 10:13, Sam Van Oort <buckyba...@gmail.com> wrote:
> Hi again Reiner,
>
> I can understand your German okay with the aid of a dictionary, and it
> is good to practice reading Deutch.  Feel free to continue in that
> language if you prefer.
>
> Where did you find the fix you quoted?  I'm not getting any results in
> the documentation, groups, or code.  In any case, disabling the check
> may prevent the error, but I think there is still a problem with the
> H2 program.
>
> Could you post a self-contained test case which causes the original
> problem?  Something short and simple maybe?
>
> Cheers,
> Sam
>
> On Jan 5, 3:34 am, Bratmaxxe <reiner.l...@gmx.de> wrote:
>
>
>
> > Hi Sam,
>
> > i think i found the problem.
>
> > I used following fix:
>
> >                 // FIX --> RuntimeException: freeCount expected
> >                 // The problem occurs in Storage.refillFreeList(). This 
> > method was
> > introduced in
> >                 // version 1.0.76 (2008-07-27) to solve the problem "The 
> > database
> > file
> >                 // was growing after deleting many rows, and after large 
> > update
> > operations".
> >                 System.setProperty("h2.check", "false");
>
> > After deleting this code snippet, everything seemd to work fine...
>
> > Greetings
> > Reiner
>
> > On 5 Jan., 09:19, Bratmaxxe <reiner.l...@gmx.de> wrote:
>
> > > Hi Sam,
>
> > > ok let's try to solve the problem ;)
>
> > > I am using H2 Version 1.2.126 in Embedded Mode (org.h2.Driver) -
> > > connectionstring : "jdbc:h2:C:\dblocation\mydb"
>
> > > I have some tables in the DB, and the problem occurs in the table
> > > named "MWI5REP", which contains 25493 Rows.
>
> > > If i do a simple select * my java program throws the following
> > > exception:
>
> > > org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler:
> > > "java.lang.ArrayIndexOutOfBoundsException: 512"
> > > General error: "java.lang.ArrayIndexOutOfBoundsException: 512"; SQL
> > > statement:
> > > SELECT MWI5REP.* FROM MWI5REP  WHERE  MWI5REP.I5RCTX = 100 AND
> > > MWI5REP.I5D0NB = 677 AND I5CQST = 'F' AND I5W5NB > 0 ORDER BY I5RCTX,
> > > I5D0NB, I5CRNB, I5W3NB, I5W4NB, I5XXTX [50000-126]
> > >         at org.h2.message.Message.getSQLException(Message.java:110)
> > >         at org.h2.message.Message.convert(Message.java:287)
> > >         at org.h2.message.Message.convert(Message.java:248)
> > >         at org.h2.command.Command.executeQuery(Command.java:134)
> > >         at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:
> > > 76)
>
> > >         ....
>
> > > Caused by: java.lang.ArrayIndexOutOfBoundsException: 512
> > >         at org.h2.store.DataPage.writeInt(DataPage.java:139)
> > >         at org.h2.store.DataPage.writeValue(DataPage.java:415)
> > >         at org.h2.result.ResultDiskBuffer.addRows
> > > (ResultDiskBuffer.java:93)
> > >         at org.h2.result.LocalResult.addRowsToDisk(LocalResult.java:
> > > 285)
> > >         at org.h2.result.LocalResult.addRow(LocalResult.java:280)
> > >         at org.h2.command.dml.Select.queryFlat(Select.java:499)
> > >         at org.h2.command.dml.Select.queryWithoutCache(Select.java:
> > > 558)
> > >         at org.h2.command.dml.Query.query(Query.java:243)
> > >         at org.h2.command.CommandContainer.query(CommandContainer.java:
> > > 81)
> > >         at org.h2.command.Command.executeQuery(Command.java:132)
> > >         ... 41 more
>
> > > Is there anything i can do, to prohibit the problem ?
>
> > > I tried to setMaxRows to 1000 or used VMARGS (increased XMX and xms
> > > memory to 1024) but without success !
>
> > > Thanks in advantage
>
> > > sincerely
> > > Reiner Lott
>
> > > On 5 Jan., 08:42, Sam Van Oort <buckyba...@gmail.com> wrote:
>
> > > > Hallo,
>
> > > > (Es tut mir leid. Meine Deutsch is sehr schlect aber ich will Sie
> > > > helfen.)
>
> > > > Die Fehler is sehr schlimm aber Sie muss uns Information geben.
>
> > > > Ist Ihre H2 Version alt?
>
> > > > Was sind die Einstellungen?
>
> > > > Könnten Sie ein kurz Testfall geben?
>
> > > > -- Sam Van Oort
> > > > On Jan 5, 1:20 am, Bratmaxxe <reiner.l...@gmx.de> wrote:
>
> > > > > Hallo,
>
> > > > > ich habe ein Problem mit meiner H2 DB.
>
> > > > > Es gibt eine Tabelle Namens MWI5REP, welche 25493 Datensätze enthält.
>
> > > > > Sofern ich ein Select * mache, wirft mir meine Anwendung eine
> > > > > Exception:
>
> > > > > org.h2.jdbc.JdbcSQLException: Allgemeiner Fehler:
> > > > > "java.lang.ArrayIndexOutOfBoundsException: 512"
> > > > > General error: "java.lang.ArrayIndexOutOfBoundsException: 512"; SQL
> > > > > statement:
> > > > > SELECT MWI5REP.* FROM MWI5REP  WHERE  MWI5REP.I5RCTX = 100 AND
> > > > > MWI5REP.I5D0NB = 677 AND I5CQST = 'F' AND I5W5NB > 0 ORDER BY I5RCTX,
> > > > > I5D0NB, I5CRNB, I5W3NB, I5W4NB, I5XXTX [50000-126]
> > > > >         at org.h2.message.Message.getSQLException(Message.java:110)
> > > > >         at org.h2.message.Message.convert(Message.java:287)
> > > > >         at org.h2.message.Message.convert(Message.java:248)
> > > > >         at org.h2.command.Command.executeQuery(Command.java:134)
> > > > >         at 
> > > > > org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:76)
>
> > > > >         ....
>
> > > > > Caused by: java.lang.ArrayIndexOutOfBoundsException: 512
> > > > >         at org.h2.store.DataPage.writeInt(DataPage.java:139)
> > > > >         at org.h2.store.DataPage.writeValue(DataPage.java:415)
> > > > >         at 
> > > > > org.h2.result.ResultDiskBuffer.addRows(ResultDiskBuffer.java:93)
> > > > >         at 
> > > > > org.h2.result.LocalResult.addRowsToDisk(LocalResult.java:285)
> > > > >         at org.h2.result.LocalResult.addRow(LocalResult.java:280)
> > > > >         at org.h2.command.dml.Select.queryFlat(Select.java:499)
> > > > >         at 
> > > > > org.h2.command.dml.Select.queryWithoutCache(Select.java:558)
> > > > >         at org.h2.command.dml.Query.query(Query.java:243)
> > > > >         at 
> > > > > org.h2.command.CommandContainer.query(CommandContainer.java:81)
> > > > >         at org.h2.command.Command.executeQuery(Command.java:132)
> > > > >         ... 41 more
>
> > > > > Gibt es eine Möglichkeit diesen Fehler zu unterbinden ?
>
> > > > > Ein setMaxRows auf 1000 Zeilen oder VMARGS (xmx und xms auf 1024)
> > > > > brachten auch keinen Erfolg...
>
> > > > > Über eine Hilfe wäre ich dankbar !
>
> > > > > Gruß
>
> > > > > gez.
> > > > > Reiner Lott- Zitierten Text ausblenden -
>
> > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

--

You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-datab...@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.


Reply via email to