-
Sep 28th, 2011, 04:53 PM
#1
Session scoped bean encountering deadlock
Looking ideas on how to work around a deadlock issue with Session Scoped Spring beans caused when trying to destroy the bean on session invalidation?
Looking at the scenario for the application, it looks like a transaction was taking a long time because of performance issues on the back end so the user initiated a log off, which in turn is supposed to destroy the session bean but there is a lock on the session object where the session scoped bean is waiting to return a value. Any workarounds for this?
More details, stacktrace below:
----------------------------------
Looks like two threads accessing the session object at the same time. Thread #17 grabbed 'MemorySessionData' to remove values because it wants to log off. Thread #5 already has 'MemorySessionData' because it wants to get values as part of a transaction.
Found one Java-level deadlock:
=============================
"WebContainer : 17":
waiting to lock monitor 0x00000000050d10f0 (object 0xfffffd7cbab76a40, a com.ibm.ws.webcontainer.httpsession.HttpSessionFac ade),
which is held by "WebContainer : 5"
"WebContainer : 5":
waiting to lock monitor 0x00000000050d1088 (object 0xfffffd7cc53aa820, a com.ibm.ws.webcontainer.httpsession.MemorySessionD ata),
which is held by "WebContainer : 17"
Java stack information for the threads listed above:
================================================== =
"WebContainer : 17":
at org.springframework.web.context.request.SessionSco pe.get(SessionScope.java:89)
- waiting to lock <0xfffffd7cbab76a40> (a com.ibm.ws.webcontainer.httpsession.HttpSessionFac ade)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:298 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.aop.target.SimpleBeanTargetSou rce.getTarget(SimpleBeanTargetSource.java:33)
at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.getTarget(Cglib2AopProxy. java:666)
at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:616)
at <application code>.$$EnhancerByCGLIB$$eb0225ce.getSessionApplic ationForm(<generated>)
at <application code>.getApplicationFormValue(<application code>..java:253)
at sun.reflect.GeneratedMethodAccessor239.invoke(Unkn own Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:182)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :149)
at org.springframework.aop.interceptor.ExposeInvocati onInterceptor.invoke(ExposeInvocationInterceptor.j ava:89)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy94.getWithdrawalFormValue(Unknown Source)
at <application code>.ApplicationTransactionServiceImpl.cleanupTra nsaction(<application code>.java:139)
... <application code>...
at sun.reflect.GeneratedMethodAccessor2058.invoke(Unk nown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.springframework.beans.factory.support.Disposab leBeanAdapter.invokeCustomDestroyMethod(Disposable BeanAdapter.java:208)
at org.springframework.beans.factory.support.Disposab leBeanAdapter.destroy(DisposableBeanAdapter.java:1 65)
at org.springframework.beans.factory.support.Disposab leBeanAdapter.run(DisposableBeanAdapter.java:134)
at org.springframework.web.context.request.ServletReq uestAttributes$DestructionCallbackBindingListener. valueUnbound(ServletRequestAttributes.java:269)
at com.ibm.ws.webcontainer.httpsession.SessionData.pr ocessListeners(SessionData.java:929)
at com.ibm.ws.webcontainer.httpsession.SessionData.re moveValueGuts(SessionData.java:891)
- locked <0xfffffd7cc53aa820> (a com.ibm.ws.webcontainer.httpsession.MemorySessionD ata)
at com.ibm.ws.webcontainer.httpsession.SessionData.re moveValue(SessionData.java:1270)
at com.ibm.ws.webcontainer.httpsession.SessionData.re moveAttribute(SessionData.java:1126)
at com.ibm.ws.webcontainer.httpsession.HttpSessionFac ade.removeAttribute(HttpSessionFacade.java:165)
at com.ibm._jsp._LogOffJSP.invalidateSession(_Interna lLogOffJSP.java:171)
at com.ibm._jsp._LogOffJSP._jspService(_InternalLogOf fJSP.java:361)
....
at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
"WebContainer : 5":
at com.ibm.ws.webcontainer.httpsession.SessionData.ge tValueGuts(SessionData.java:841)
- waiting to lock <0xfffffd7cc53aa820> (a com.ibm.ws.webcontainer.httpsession.MemorySessionD ata)
at com.ibm.ws.webcontainer.httpsession.SessionData.ge tValue(SessionData.java:1248)
at com.ibm.ws.webcontainer.httpsession.SessionData.ge tAttribute(SessionData.java:1134)
at com.ibm.ws.webcontainer.httpsession.HttpSessionFac ade.getAttribute(HttpSessionFacade.java:120)
at org.springframework.web.context.request.ServletReq uestAttributes.getAttribute(ServletRequestAttribut es.java:109)
at org.springframework.web.context.request.AbstractRe questAttributesScope.get(AbstractRequestAttributes Scope.java:41)
at org.springframework.web.context.request.SessionSco pe.get(SessionScope.java:90)
- locked <0xfffffd7cbab76a40> (a com.ibm.ws.webcontainer.httpsession.HttpSessionFac ade)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:298 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.aop.target.SimpleBeanTargetSou rce.getTarget(SimpleBeanTargetSource.java:33)
at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.getTarget(Cglib2AopProxy. java:666)
at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:616)
at <application code>.$$EnhancerByCGLIB$$6476f31.getApplicationVal ue(<generated>)
... <application code>...
at sun.reflect.GeneratedMethodAccessor2116.invoke(Unk nown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBi ndingImpl.java:127)
<application code>...
at com.sun.faces.lifecycle.LifecycleImpl.phase(Lifecy cleImpl.java:228)
at com.sun.faces.lifecycle.LifecycleImpl.execute(Life cycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServl et.java:197)
Looks like someone else had similar issue... http://forum.springsource.org/showth...ation-and-AOP&
(We are in process of migrating to tcServer btw :-) )
Thanks!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules