longzenvo / log4jdbc

Automatically exported from code.google.com/p/log4jdbc
0 stars 0 forks source link

OOM when using batchUpdate #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. using batchUpdate with thousands of insert records
2.
3.

What is the expected output? What do you see instead?
should not give OOM

What version of the product are you using? On what operating system?
1.2

Please provide any additional information below.

Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2882)
        at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
        at java.lang.StringBuffer.append(StringBuffer.java:224)
        at net.sf.log4jdbc.Slf4jSpyLogDelegator.buildSqlTimingDump(Slf4jSpyLogDelegator.java:415)
        at net.sf.log4jdbc.Slf4jSpyLogDelegator.sqlTimingOccured(Slf4jSpyLogDelegator.java:370)
        at net.sf.log4jdbc.StatementSpy._reportSqlTiming(StatementSpy.java:333)
        at net.sf.log4jdbc.StatementSpy.reportSqlTiming(StatementSpy.java:310)
        at net.sf.log4jdbc.StatementSpy.executeBatch(StatementSpy.java:527)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
        at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:881)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:619)
        at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:866)
        at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.doExecuteBatchUpdate(SimpleJdbcTemplate.java:266)
        at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.batchUpdate(SimpleJdbcTemplate.java:243)

Original issue reported on code.google.com by gaplo...@gmail.com on 19 Jun 2013 at 6:56

GoogleCodeExporter commented 9 years ago
when use MyBatis,and  execute batchSave also OOM

example:

    <insert id="batchSave">
        insert into table_name(id,column_a,column_b,date_time)
        <foreach collection="list" item="item" index="index" separator="UNION ALL">
            select sys_guid(),
            #{item.columnA,jdbcType=VARCHAR},
            #{item.columnB,jdbcType=VARCHAR},
            sysdate
            from dual
        </foreach>
    </insert>

Original comment by sgq0...@gmail.com on 17 Apr 2014 at 2:25

GoogleCodeExporter commented 9 years ago
What is your batch size?

Original comment by arthur.b...@gmail.com on 17 Apr 2014 at 10:39

GoogleCodeExporter commented 9 years ago
Is there a way to resolve this

Original comment by gireesh....@gmail.com on 25 Nov 2014 at 7:30