PreparedStatementCache导致Java heap space

今天发现PreparedStatementCache会导致java heap space full



 

DBCP的poolPreparedStatements是在每个connection中缓存一定数量的preparestatement,用于减少driver的statement对象创建,和数据库的网络交互以及数据库的cursor创建。

 

 

<property name="poolPreparedStatements" value="true" />  
<property name="maxOpenPreparedStatements" value="10" />
 这段报错可以重线,我觉得很上面的SQL有点关系,暂时先去掉PreparedStatementCache

 

去掉prepacedStatementCache还是会报错:

13-04-09 00:21:47 [INFO] com.duitang.biz.common.SqlServiceImpl  - SELECT cost 5079ms: SELECT COUNT(*) FROM `auth_user`
Exception in thread "btpool0-5" java.lang.OutOfMemoryError: GC overhead limit exceeded
Exception in thread "ReplicaSetStatus:Updater" 13-04-09 00:23:38 [ERROR] com.duitang.dboss.service.ServiceInvoker  - ServiceInvoker FAIL url=dboss://sqlService/queryForList?param1=SELECT+%60auth_user%60.%60id%60%2C+%60auth_user%60.%60username%60%2C+%60auth_user%60.%60first_name%60%2C+%60auth_user%60.%60last_name%60%2C+%60auth_user%60.%60email%60%2C+%60auth_user%60.%60password%60%2C+%60auth_user%60.%60is_staff%60%2C+%60auth_user%60.%60is_active%60%2C+%60auth_user%60.%60is_superuser%60%2C+%60auth_user%60.%60last_login%60%2C+%60auth_user%60.%60date_joined%60+FROM+%60auth_user%60+ORDER+BY+%60auth_user%60.%60username%60+ASC&param2=%5B%5D
13-04-09 00:23:38 [ERROR] com.duitang.dboss.service.ServiceInvoker  - ServiceInvoker FAIL url=dboss://sqlService/queryForList?param1=SELECT+%60auth_user%60.%60id%60%2C+%60auth_user%60.%60username%60%2C+%60auth_user%60.%60first_name%60%2C+%60auth_user%60.%60last_name%60%2C+%60auth_user%60.%60email%60%2C+%60auth_user%60.%60password%60%2C+%60auth_user%60.%60is_staff%60%2C+%60auth_user%60.%60is_active%60%2C+%60auth_user%60.%60is_superuser%60%2C+%60auth_user%60.%60last_login%60%2C+%60auth_user%60.%60date_joined%60+FROM+%60auth_user%60+ORDER+BY+%60auth_user%60.%60username%60+ASC&param2=%5B%5D
java.lang.OutOfMemoryError: Java heap space
13-04-09 00:23:38 [ERROR] com.duitang.dboss.remote.nio.DbossServerHandler  - Dboss invoker ERROR
com.duitang.dboss.remote.oio.DbossException: java.lang.reflect.InvocationTargetException
	at com.duitang.dboss.service.ServiceInvoker.accept(ServiceInvoker.java:99)
	at com.duitang.dboss.remote.nio.DbossServerHandler.messageReceived(DbossServerHandler.java:80)
	at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:98)
	at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
	at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:796)
	at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:69)
	at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:307)
	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:662)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.duitang.dboss.service.ServiceInvoker.accept(ServiceInvoker.java:89)
	... 9 more
Caused by: java.lang.OutOfMemoryError: Java heap space
	at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2123)
	at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1900)
	at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3401)
	at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:483)
	at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3096)
	at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2266)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2687)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2318)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:644)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:714)
	at com.duitang.biz.common.SqlServiceImpl.queryForList(SqlServiceImpl.java:109)
	... 13 more

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值