Bug #366 (closed)
Opened 18 years ago
Closed 18 years ago
IAdmin.unlock is failing with a HibernateException wrt two open sessions.
Reported by: | jamoore | Owned by: | jamoore |
---|---|---|---|
Priority: | critical | Cc: | |
Sprint: | n.a. | ||
Total Remaining Time: | n.a. |
Description
r962 (impl. for #81) has broken IAdmin.unlock() at least on the server side. This may be a fairly rare occurrence but it is causing LockingTest to break.
ome.conditions.InternalException: Wrapped Exception: (org.springframework.orm.hibernate3.HibernateSystemException): Illegal attempt to associate a collection with two open sessions; nested exception is org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:413) at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:110) at ome.tools.hibernate.SessionHandler.invoke(SessionHandler.java:175) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at ome.tools.hibernate.ProxyCleanupFilter$Interceptor.invoke(ProxyCleanupFilter.java:158) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at ome.services.util.ServiceHandler.invoke(ServiceHandler.java:99) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209) at $Proxy17.unlock(Unknown Source)
Apparently what's happening is that the Event.eventLogs collection is being passed back out of a service and then being passed back in. What's worrisome is that that session should have been closed. (This exception won't be thrown if one of the two sessions is closed.) Possibly related to #61 and less likely related to #326.
Change History (4)
comment:1 Changed 18 years ago by jmoore
comment:2 Changed 18 years ago by jmoore
- Priority changed from minor to critical
Arg. Now appearing client-side (after copying the exact server tests to the client side). Upping priority.
comment:3 Changed 18 years ago by jmoore
Forensics:
- AOP starts a session (S1)
- AdminImpl.unlock starts a new session (S2)
- S2 is flushed.
- in UpdateEventListener, the event from secSys.currentEvent() is placed in the object to unlock.
The most likely fix is to replace secSys.currentEvent with a S2 event. However, if there are or are ever other locations where objcts from S1 are placed inside of the object to lock, similar issues could arise.
Other options include:
- manually calling secSys.setCurrentDetails()
- adding an annotation (@NoSession?) to prevent SessionHandler from starting S1.
comment:4 Changed 18 years ago by jmoore
- Resolution set to fixed
- Status changed from new to closed
#323 may be necessary to have this function. unlock() already passes EmptyInterceptor into the new Session, perhaps some of our EventListeners have to be disabled as well.