From: Maarten W. (JIRA) <no...@at...> - 2006-07-28 00:46:20
|
Proxies are never unassociated (evicted) from a session ------------------------------------------------------- Key: HHH-1954 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1954 Project: Hibernate3 Type: Bug Versions: 3.2.0.cr3 Reporter: Maarten Winkels When evicting (either directly or by cascade) a proxy from a session, the proxy is removed from an internal map (proxiesByKey), but the proxy's lazy initializer still has reference to the session. This allows for lazy initialization of a proxy even after the proxy is evicted. This seems semantically incorrect: The documentation of LazyInitializer.getSession() reads: "Get the session, if this proxy is attached" an proxy evicted from a session should cleary not remain attached to the session. The current implementation leads to concurrent modification exceptions, when one thread detaches entities from one session and another attaches these entities to another. The method AbstractLazyInitializer.isConnectedToSession() is called when locking a proxy to a session. This will search the old session for the proxy (in the containsProxy() call). When another thread is manipulating this sessions proxy ByLey map, a concurrent modification exception will occure. Note that each session is used in a thread-safe context by the application! When reassociating a proxy to the new session, hibernate breaks the thread-safety by querying the other session. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |