https://bz.apache.org/bugzilla/show_bug.cgi?id=60764
Bug ID: 60764 Summary: SlowQueryReport causing connection leak Product: Tomcat Modules Version: unspecified Hardware: PC Status: NEW Severity: major Priority: P2 Component: jdbc-pool Assignee: dev@tomcat.apache.org Reporter: mark.hou...@sony.com Target Milestone: --- Tomcat versions: 8.5.11, 7.0.75 I have a project that uses hibernate with optimistic locking and whenever it tries to do a rollback after an optimistic lock exception, the connection remains active and is not returned to the pool. This only happens when I have the SlowQueryReport interceptor configured on my JDBC datasource in server.xml. Here is the relevant stack trace: 20:06:59.566 level:DEBUG class:org.springframework.orm.jpa.EntityManagerFactoryUtils principal: Unexpected exception on closing JPA EntityManager java.lang.reflect.UndeclaredThrowableException: null at com.sun.proxy.$Proxy40.hashCode(Unknown Source) at java.util.HashMap.hash(HashMap.java:338) at java.util.HashMap.get(HashMap.java:556) at org.hibernate.resource.jdbc.internal.ResourceRegistryStandardImpl.release(ResourceRegistryStandardImpl.java:76) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:157) at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.release(AbstractBatchImpl.java:195) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:190) at org.hibernate.internal.SessionImpl.close(SessionImpl.java:424) at org.hibernate.jpa.internal.EntityManagerImpl.close(EntityManagerImpl.java:145) at org.springframework.orm.jpa.EntityManagerFactoryUtils.closeEntityManager(EntityManagerFactoryUtils.java:438) at org.springframework.orm.jpa.JpaTransactionManager.doCleanupAfterCompletion(JpaTransactionManager.java:602) at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1016) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:811) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy215.test(Unknown Source) at com.sony.snei.mm.quartz.job.AbstractCategoryLayoutJob$1.run(AbstractCategoryLayoutJob.java:71) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: Statement closed. at org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:226) ... 22 common frames omitted The problem is that hashCode() is called on the connection after it has been closed and that causes StatementProxy to throw the "Statement closed" exception. I think that it should allow hashCode() and equals() to be called on the delegate even after the connection is closed. Thanks, Mark -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org