Issue 1:
wang sheng opened SPR-2854 and commented

when use HibernateTransactionManager manage hibernate transaction

if begin a transaction fail it would not throw a IllegalStateException

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed:

Caused by:

org.hibernate.TransactionException: JDBC begin failed:

at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)

at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1290)

at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:494)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.handleExistingTransaction(AbstractPlatformTransactionManager.java:354)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:296)

at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:257)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)

at $Proxy325.synchronizationTsDBPublish(Unknown Source)

at com.gemship.vop.service.impl.VoyagePlanServiceImpl.updateVoyagePlan(VoyagePlanServiceImpl.java:195)

at com.gemship.vop.service.impl.VoyagePlanServiceImpl.saveOrUpdateVoyagePlan(VoyagePlanServiceImpl.java:316)

at com.gemship.vop.service.impl.VoyagePlanServiceImpl.saveOrUpdateVoyagePlans2(VoyagePlanServiceImpl.java:349)

at com.gemship.vop.service.impl.VoyagePlanServiceImpl.doPublish(VoyagePlanServiceImpl.java:911)

at com.gemship.vop.service.impl.VoyagePlanServiceImpl.doPublish(VoyagePlanServiceImpl.java:877)

at sun.reflect.GeneratedMethodAccessor289.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:615)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)

at $Proxy329.doPublish(Unknown Source)

at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:615)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)

at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:70)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)

at $Proxy582.doPublish(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:615)

at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:181)

at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)

at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:76)

at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:112)

at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:117)

at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:47)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:806)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:736)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)

at com.gfa4j.web.SessionFilter.doFilter(Unknown Source)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)

at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:696)

at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:641)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)

at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)

at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)

at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)

at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)

at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)

at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)

at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)

at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)

at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)

at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)

Caused by:

java.sql.SQLException: Io exception: There is no process to read data written to a pipe.

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)

at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3678)

at oracle.jdbc.ttc7.TTC7Protocol.setAutoCommit(TTC7Protocol.java:562)

at oracle.jdbc.driver.OracleConnection.setAutoCommit(OracleConnection.java:1288)

at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:755)

at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:63)

... 76 more

[11/21/06 14:39:15:782 GMT+08:00] 00000038 SystemOut O 14:39:15,769 WARN RemoteInvocationTraceInterceptor:80 - Processing of HttpInvokerServiceExporter remote call resulted in fatal exception: com.gemship.vop.service.VoyagePlanService.doPublish

java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active

at java.lang.Throwable.<init>(Throwable.java:57)

at java.lang.Throwable.<init>(Throwable.java:68)

at org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization(TransactionSynchronizationManager.java:268)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:788)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:663)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:608)

at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:328)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:111)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)

at $Proxy329.doPublish(Unknown Source)

at sun.reflect.GeneratedMethodAccessor288.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:615)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)

at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:70)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)

at $Proxy582.doPublish(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:615)

at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:181)

at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)

at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:76)

at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:112)

at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:117)

at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:47)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:806)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:736)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)

at com.gfa4j.web.SessionFilter.doFilter(Unknown Source)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)

at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:696)

at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:641)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)

at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)

at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)

at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)

at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)

at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)

at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)

at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)

at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)

at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)

at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)

at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)

Affects: 2.0 final

Issue Links:

#7003 Transaction synchronization error with PROPAGATION_REQUIRES_NEW and error obtaining new connection ("duplicates")

Issue 2:
Bozhidar Bozhanov opened SPR-9036 and commented

org.springframework.cache.interceptor.DefaultKeyGenerator is implemented by calculating the hashcode of all arguments. This is problematic in many cases:

methods with similar signature - foo(int, String), foo(int, List) - if the 2nd argument is null they will get mixed

methods with the same signature in different classes, using the same cache - they will get mixed

is there a collision resolution mechanism? If not, things will randomly fail. Rarely, but they will. Imagine that the arguments of two distinct methods (that use the same cache region) evaluate to the same hashcode (not unlikely) - they will override each other's values, and possibly a ClassCastException will occur on retrieval

What is in the first place the reason to get the hashcodes? The underlying cache mechanism is a hashtable of some sort, so it will calculate the hash of the key anyway. But it will have a collision-resolution strategy, unlike the KeyGenerator.

I suggest:

concatenating the string representations of primitives, and the hashcode of non-primitives.

adding the class name and method name to the key

optionally, where non-primitive values are used as keys, log a warning - this is usually wrong, as the hashcode will change even though the values inside the object are the same

Attachments:

TestDefaultKeyGenerator.java (2.01 kB)

Issue Links:

#14870 Cacheable key collision with DefaultKeyGenerator ("duplicates")

#14870 Cacheable key collision with DefaultKeyGenerator

#14013 org.springframework.cache.interceptor.DefaultKeyGenerator has too weak hashing functionality

9 votes, 11 watchers