-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: reassociation of cached objects
PostPosted: Wed Feb 02, 2005 9:22 pm 
OSCache Developer
OSCache Developer

Joined: Fri Jun 11, 2004 1:20 pm
Posts: 12
Hibernate version: 2.1.7

We are trying to determine how a cached object is reassociated to a session and given a proxy and CGLIBLazyInitializer.

When cached objects are concurrently accessed, we occasionally have the error: Session was closed, or Session is closed.

We have done extensive logging on the sessionImpl object to see its history. The relevant bit is pasted below. The error occurs because the proxy for an object fetched from the cache is part of a session that is being used by another thread. The owning thread closes the session before the new thread is done using the proxy, hence the error.

We know that the object is not being held anywhere except the hibernate cache between requests. So my question is how the proxy gets created for an object fetched from the cache. I have looked at the source but I'm still trying to figure out how all the CGLIB pieces fit together. We are certain that the thread that gets the error is passed the correct session in all hibernate calls from our code.

// Session creation and assignment on thread 8
TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - Constructor for session: net.sf.hibernate.impl.SessionImpl@664e93 on thread : TP-Processor8
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - opened session
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - TP-Processor8 assigned: net.sf.hibernate.impl.SessionImpl@664e93 SpringSessionFactoryUtils ln 348

// getProxy call and CGLIBLI created on thread 8 for guild#109201
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - getProxy called - persistentClassclass com.sony.soe.guilds.model.Guild : id = 109201
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - CGLIBLazyInitializer created : net.sf.hibernate.proxy.CGLIBLazyInitializer@ecdbe8

// Thread 7 adds guild#109201 as entry to the session associated to thread 8
// why is there no new getProxy call? or added to the right session?
,TP-Processor7 : net.sf.hibernate.impl.SessionImpl@664e93 - WRONG THREAD, this session belongs to: TP-Processor8
, TP-Processor7 : net.sf.hibernate.impl.SessionImpl@664e93 - Entry added : com.sony.soe.guilds.model.Guild@10f2e02 : id= 109201
, TP-Processor7 : net.sf.hibernate.impl.SessionImpl@664e93 - WRONG THREAD, this session belongs to: TP-Processor8
, TP-Processor7 : net.sf.hibernate.impl.SessionImpl@664e93 - getProxy called - persistentClassclass com.sony.soe.guilds.model.GuildAgg : id = 109201
, TP-Processor7 : net.sf.hibernate.impl.SessionImpl@664e93 - WRONG THREAD, this session belongs to: TP-Processor8
, TP-Processor7 : net.sf.hibernate.impl.SessionImpl@664e93 - CGLIBLazyInitializer created : net.sf.hibernate.proxy.CGLIBLazyInitializer@15dddf2
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - initializing non-lazy collections
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - disconnecting session
, TP-Processor8 : net.sf.hibernate.impl.SessionImpl@664e93 - transaction completion

...Errors here when Thread 7 tries to access the session. it has been closed.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 9:24 pm 
OSCache Developer
OSCache Developer

Joined: Fri Jun 11, 2004 1:20 pm
Posts: 12
Could this be related to the behavior described here:
http://forum.hibernate.org/viewtopic.ph ... eassociate

I want to reiterate that the only reference to these objects between requests are in the hibernate cache.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.