T4CPreparedStatement内存泄露现象
现象
- 200并发压测压10分钟左右内存吃满
- jmap -histo | head 20 发现有大量的Connection对象和T4CPreparedStatement以及部分Finalizer对象,dump下来分析发现Connection和PreparedStatement这些对象都是no gc root
线程dump发现finalizer线程时常blocked在connection.isReallyClosed,而拿着锁的线程在执行数据库读写
"Finalizer" - Thread t@3 java.lang.Thread.State: BLOCKED at oracle.jdbc.driver.PhysicalConnection.isClosed(PhysicalConnection.java:1508) - waiting to lock <785dbebb> (a oracle.jdbc.driver.T4CConnection) owned by "http-bio-80-exec-19" t@70 at org.logicalcobwebs.proxool.ProxyConnection.isReallyClosed(ProxyConnection.java:206) at org.logicalcobwebs.proxool.WrappedConnection.invoke(WrappedConnection.java:114) at org.logicalcobwebs.proxool.WrappedConnection.intercept(WrappedConnection.java:87) at oracle.jdbc.internal.OracleConnection$$EnhancerByProxool$$9245683f.finalize(&l