You shouldn't be putting CFCs in the session scope... Period. I would try and find and alternative method for calling/instantiating them.
"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions." Visit our website at http://www.reedexpo.com -----Original Message----- From: Jason Dunaway To: CF-Talk Sent: Fri Apr 06 16:00:34 2007 Subject: Using CFCs in session scope - need cflock help All, I posted yesterday regarding having session timeout issues before the 2hr limit we have setup. This is completely random. One of the suggestions I got was to make sure I'm using CFLOCK where appropriate. So after reading tons about CFLOCK, I'm still confused as to how it applies to session scoped components. Here is how I'm using CFCs: I create the user object in the session scope: <!---CREATE THE USER OBJECT ---> <cfobject name="session.myUser" component="/cfc/myUser"> <cfset session.myUser.init(#form.userid#)> All variables in the component are scoped at the VARIABLES level, inside the CFC. Any time that I need to get or set information inside the CFC I use getter/setter functions or I do so inside the CFC: <!---GET THE USERID---> <cffunction name="getUserID" output="false" returntype="string" access="remote"> <cfreturn variables.userID> </cffunction> The call from a page in the site would look something like: <cfset variables.currentUserID = session.myUser.getUserID()> OR <cfset session.myUser.setUserID(#form.userid#)> NOTE: There is NO <cflock> around any of these functions (as shown above). The first function would obviously return data that is in the variables scope inside the CFC.....which is in session, but not a direct "session.varname" reference which as I understand, does in fact need a <cflock> wrapped around it. Hopefully you can see my confusion. At this point I am not using <cflock> for any of my function calls to the "myUser" component in session. Do I need to do so? Technically, my understanding is that the "session.myUser" object is a complex data type variable that is in session. So any time I write/read data from this object (even if the data is inside it in the variables scope) do I need a CFLOCK around it? Such as: <cflock scope="Session" type="Exclusive" timeout="2" throwontimeout="Yes"> <cfset variables.currentUserID = session.myUser.getUserID()> </cflock> OR <cflock scope="Session" type="Exclusive" timeout="2" throwontimeout="Yes"> <cfset session.myUser.setUserID(#form.userid#)> </cflock> The book I have here in front of me (Programming ColdFusion MX, 2nd ED from o'reilly) has a section in chapter 22 called "Assigning Component Instances to Shared Variable Scopes".....it does not mention anything about using cflock for this stuff. I honestly can't confirm or deny if cflock has anything to do with our issues. I'm leaning towards it not being relevant because the problem is that the "session.myUser" object is completely gone....not corrupted by a race condition but not existing at all when using an isdefined('session.myUser'). Any help is greatly, greatly appreciated. We are trying to get to the bottom of a big problem that has our customers very unhappy (at least the ones that are timing out). thanks in advance! jason ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion MX7 and Flex 2 Build sales & marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274708 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

