Hmmm, interesting.

I don't fully understand what is going on here.

The way that the SCRIPT command works is that it creates an in-memory buffer for the outgoing commands. If the buffer exceeds a certain size then it will spool that buffer to disk using a temporary table.

Somehow, this is interacting with MVCC and your LOG/UNDO_LOG settings to cause excessive memory consumption.

I suspect that removing the UNDO_LOG=0 parameter will fix your problem.

On 2012-12-10 16:29, Dennis Nielsen wrote:
Hi Noel

I've disabled MVCC and there is no other access to the database than the backup script, and I still get an out of memory exception. I've set the heap to 128MB. If I set the UNDO_LOG=0 the transaction log should be disabled right? I've generated a new leak report and it seems to be in another place.

Command:

C:\Program Files\Barrowa\Sundial\db\bin>java -jar H2DBUtil.jar backup jdbc:h2:tcp://localhost:50115/sundial;MVCC=FALSE;DB_CLOSE_ON_EXIT=FALSE;DEFRAG_ALWAYS=TRUE;WRITE_DELAY=30000;CACHE_SIZE=65536;UNDO_LOG=0

Thanks
 - Dennis

On Monday, December 10, 2012 2:21:08 PM UTC+1, Noel Grandin wrote:

    I'm guessing you're trying to run a backup on the database while
    the database is in very active use.

    Since it's in MVCC mode and you've disabled the transaction log,
    this causes a rather large transaction log to build up while the
    slow-running Script command executes.

    I suggest you either
    (a) allocate more memory to the process or
    (b) do the backup when the database is quieter or
    (c) don't use MVCC
    (d) don't disable the transaction log

    On 2012-12-10 15:09, Dennis Nielsen wrote:
    Hi Noel

    The heap dump is from the H2 Database run as a windows service
    and is quite large (135MB). I've attached a suspected leak
    report. Do you have an estimate on heap space to allocated for
    backing up a 300-400MB database?

    Best regards
    Dennis

    On Saturday, December 8, 2012 9:46:18 AM UTC+1, Noel Grandin wrote:

        Please can you generate a heap dump.
        see here for an example.
        
http://stackoverflow.com/questions/542979/using-heapdumponoutofmemoryerror-parameter-for-heap-dump-for-jboss
        
<http://stackoverflow.com/questions/542979/using-heapdumponoutofmemoryerror-parameter-for-heap-dump-for-jboss>


        On Fri, Dec 7, 2012 at 6:07 PM, Dennis Nielsen
        <[email protected]> wrote:

            Hi

            I'm having a database file on around 300MB and when I try
            to use the following java code:

            Script./execute/(url,"sa","",file);

            The java code runs in tomcat 7.0.32 webapp and access H2
            installed as a windows service (see url below). Will the
            write delay prevent any disk access for 30 seconds? Are
            there any of the settings that could lead to this out of
            memory exception? Do you have a proposal of an url? We
            use the database with quite large transaction size
            (1000-10000 entities per transaction). Any proposals will
            be greatly appreciated.

            Out of memory exception:

            org.h2.jdbc.JdbcSQLException: Out of memory.; SQL statement:
            SCRIPT [90108-169]
            at
            org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
            at org.h2.message.DbException.get(DbException.java:158)
            at org.h2.message.DbException.convert(DbException.java:275)
            at org.h2.command.Command.executeQuery(Command.java:195)
            at
            org.h2.server.TcpServerThread.process(TcpServerThread.java:308)
            at
            org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
            at java.lang.Thread.run(Unknown Source)
            Caused by: java.lang.OutOfMemoryError: Java heap space

            at org.h2.engine.SessionRemote.done(SessionRemote.java:567)
            at
            org.h2.command.CommandRemote.executeQuery(CommandRemote.java:151)
            at
            org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:76)
            at org.h2.tools.Script.process(Script.java:172)
            at org.h2.tools.Script.execute(Script.java:153)
            at org.h2.tools.Script.execute(Script.java:133)
            at com.barrowa.common.util.H2DBUtil.backup(H2DBUtil.java:47)
            at com.barrowa.common.util.H2DBUtil.compact(H2DBUtil.java:36)
            at
            
com.barrowa.core.sundial.jobs.DatabaseMaintenanceJob.compact(DatabaseMaintenanceJob.java:215)
            at
            
com.barrowa.core.sundial.jobs.DatabaseMaintenanceJob.execute(DatabaseMaintenanceJob.java:83)
            at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
            at
            
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)


            H2 url:

            
jdbc:h2:tcp://localhost:50115/sundial;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE;DEFRAG_ALWAYS=TRUE;WRITE_DELAY=30000;CACHE_SIZE=65536;LOCK_MODE=0;LOG=0;UNDO_LOG=0

-- You received this message because you are subscribed to
            the Google Groups "H2 Database" group.
            To view this discussion on the web visit
            https://groups.google.com/d/msg/h2-database/-/i9LoF-T1AKEJ 
<https://groups.google.com/d/msg/h2-database/-/i9LoF-T1AKEJ>.
            To post to this group, send email to
            [email protected].
            To unsubscribe from this group, send email to
            [email protected].
            For more options, visit this group at
            http://groups.google.com/group/h2-database?hl=en
            <http://groups.google.com/group/h2-database?hl=en>.


-- You received this message because you are subscribed to the
    Google Groups "H2 Database" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/h2-database/-/XXUCJ99q8TcJ
    <https://groups.google.com/d/msg/h2-database/-/XXUCJ99q8TcJ>.
    To post to this group, send email to [email protected]
    <javascript:>.
    To unsubscribe from this group, send email to
    [email protected] <javascript:>.
    For more options, visit this group at
    http://groups.google.com/group/h2-database?hl=en
    <http://groups.google.com/group/h2-database?hl=en>.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/vEMTJ-E-GmIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

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

Reply via email to