首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

c3p0存在紧急bug

2012-07-02 
c3p0存在严重bug开发的系统使用了Spring JdbcTemplate + c3p0组合,在做性能测试的时候出现了严重的性能问

c3p0存在严重bug

开发的系统使用了Spring JdbcTemplate + c3p0组合,在做性能测试的时候出现了严重的性能问题。40的并发访问,开始的时候系统正常,等过了几分钟后,应用程序不能访问了。停止40并发的压力后,过1分钟左右又可以正常访问应用程序了,很迷茫。后台log文件有警告信息:

[com.mchange.v2.async.ThreadPoolAsynchronousRunner:435]-[WARN] com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@4ec5571b -- APPARENT DEADLOCK!!! Complete Status: [num_managed_threads: 10, num_active: 10;  activeTasks:  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7dd9d603 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#6),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@68719f81 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#9),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7b9f03b8 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#7),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4ad6470 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#4),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@139cf776 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@263a6e09 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@460e247a (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#3),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4a7ce984 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4ec6ff50 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#5),  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6aa40597 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#8);  pendingTasks:  com.mchange.v2.resourcepool.BasicResourcePool$6@366b3333,  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@37ee752e,  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@84f3bb2,  com.mchange.v2.resourcepool.BasicResourcePool$6@9d82761,  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@4e015653,  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@39ca8b27,  com.mchange.v2.resourcepool.BasicResourcePool$6@2075cb15,  com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1567e059,  com.mchange.v2.resourcepool.BasicResourcePool$6@56b9fe09, 

?可以看到AcquireTask占用了内部线程池的所有线程,没有线程可以来执行BasicResourcePool$6对应的任务,而这个任务的作用就是把池外使用完的连接放回池内的,c3p0被挂起了。

?

我的解决方法是用单独的线程来处理“归还”连接的任务,因为这个任务的优先级最高,而且耗费的时间很短。

?

上传我修改后的 c3p0 jar包,只改了一个文件:BasicResourcePool

?

?

?

1 楼 qiankun 2012-01-29   很需要的,谢谢,这个真让人头痛

热点排行