Re: Cannot access session variables in a cfc
Some of the dangers to this approach include: the amount of memory allocated to the JVM. If you stuff alot of data into the Application scope, it persists in the JVM allocated memory and it's not available to the rest of the system/application. You really can't change data in the Application scope without having to reload it. I generally use the Application scope for application wide CFC instantiation, the and not actual application wide data. Just my $.02 sas On Thu, Jan 29, 2015 at 11:53 AM, John Pullam jpul...@mcleansystems.com wrote: For what it's worth, the approach of storing a global data item in the application scope seems to be legit according to the documentation. Here's what it said in the CF10 doc: Application variables are a convenient place to store information that all pages of your application might need, no matter which client is running that application. Using application variables, an application could, for example, initialize itself when the first user accesses any page of that application. This information can then remain available indefinitely, thereby avoiding the overhead of repeated initialization. Because the data stored in application variables is available to all pages of an application, and remains available until a specific period of inactivity passes or the ColdFusion server shuts down, application variables are convenient for application-global, persistent data. However, because all clients running an application see the same set of application variables, these variables are not appropriate for client-specific or session-specific information. To target variables for specific clients, use client or session variables. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360042 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
For what it's worth, the approach of storing a global data item in the application scope seems to be legit according to the documentation. Here's what it said in the CF10 doc: Application variables are a convenient place to store information that all pages of your application might need, no matter which client is running that application. Using application variables, an application could, for example, initialize itself when the first user accesses any page of that application. This information can then remain available indefinitely, thereby avoiding the overhead of repeated initialization. Because the data stored in application variables is available to all pages of an application, and remains available until a specific period of inactivity passes or the ColdFusion server shuts down, application variables are convenient for application-global, persistent data. However, because all clients running an application see the same set of application variables, these variables are not appropriate for client-specific or session-specific information. To target variables for specific clients, use client or session variables. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360041 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
+1 On Thu, Jan 29, 2015 at 12:53 PM, Russ Michaels r...@michaels.me.uk wrote: I'll add for the sake of brevity, please don't put application wide cfcs in session scope, as a hosting provider I have seen this kill a server. 5000 users = 5000 instances of the cfc. In most cases using a mapping solves the issues you have with cf not finding the cfc. On Thu, Jan 29, 2015 at 17:00 PM, Scott Stewart webmas...@sstwebworks.com wrote: Some of the dangers to this approach include: the amount of memory allocated to the JVM. If you stuff alot of data into the Application scope, it persists in the JVM allocated memory and it's not available to the rest of the system/application. You really can't change data in the Application scope without having to reload it. I generally use the Application scope for application wide CFC instantiation, the and not actual application wide data. Just my $.02 sas On Thu, Jan 29, 2015 at 11:53 AM, John Pullam jpul...@mcleansystems.com javascript:; wrote: For what it's worth, the approach of storing a global data item in the application scope seems to be legit according to the documentation. Here's what it said in the CF10 doc: Application variables are a convenient place to store information that all pages of your application might need, no matter which client is running that application. Using application variables, an application could, for example, initialize itself when the first user accesses any page of that application. This information can then remain available indefinitely, thereby avoiding the overhead of repeated initialization. Because the data stored in application variables is available to all pages of an application, and remains available until a specific period of inactivity passes or the ColdFusion server shuts down, application variables are convenient for application-global, persistent data. However, because all clients running an application see the same set of application variables, these variables are not appropriate for client-specific or session-specific information. To target variables for specific clients, use client or session variables. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360044 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
I'll add for the sake of brevity, please don't put application wide cfcs in session scope, as a hosting provider I have seen this kill a server. 5000 users = 5000 instances of the cfc. In most cases using a mapping solves the issues you have with cf not finding the cfc. On Thu, Jan 29, 2015 at 17:00 PM, Scott Stewart webmas...@sstwebworks.com wrote: Some of the dangers to this approach include: the amount of memory allocated to the JVM. If you stuff alot of data into the Application scope, it persists in the JVM allocated memory and it's not available to the rest of the system/application. You really can't change data in the Application scope without having to reload it. I generally use the Application scope for application wide CFC instantiation, the and not actual application wide data. Just my $.02 sas On Thu, Jan 29, 2015 at 11:53 AM, John Pullam jpul...@mcleansystems.com javascript:; wrote: For what it's worth, the approach of storing a global data item in the application scope seems to be legit according to the documentation. Here's what it said in the CF10 doc: Application variables are a convenient place to store information that all pages of your application might need, no matter which client is running that application. Using application variables, an application could, for example, initialize itself when the first user accesses any page of that application. This information can then remain available indefinitely, thereby avoiding the overhead of repeated initialization. Because the data stored in application variables is available to all pages of an application, and remains available until a specific period of inactivity passes or the ColdFusion server shuts down, application variables are convenient for application-global, persistent data. However, because all clients running an application see the same set of application variables, these variables are not appropriate for client-specific or session-specific information. To target variables for specific clients, use client or session variables. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360043 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
Were you using relative paths to the CFCs. That could become hairy if you move things around. I'll generally define a CFC path variable in the application.cfm then use that everywhere. Never had a problem. Of course, this assumes all the CFC's are in the same location. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360023 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
Can you give us some code examples of how it 'used' to be setup? Where was the CFC saved. Where was the CFC called. How was it called. Etc. Not that fixing the actual problem will set you suddenly into best practices, but it will fix your current headache and then you can follow up with BP later when the fires are out. Thanks, William -- William Seiter -Original Message- From: John Pullam [mailto:jpul...@mcleansystems.com] Sent: Wednesday, January 28, 2015 8:57 AM To: cf-talk Subject: Re: Cannot access session variables in a cfc I know this isn't ideal, but it is a live application and the decision to move the cfc's outside of the doc root was taken because CF was having trouble finding them (for no obvious reason). Code that has worked since CF7 started breaking. So we moved them and this problem began. I am looking for a quick solution for now, knowing that I need to develop a better one. I'm wondering about putting the variable in the Application scope? Do the cfc's have access to that? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360024 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
You will need to pass your session variables as a parameter in order to use them in the CFC, this is best practices anyways. The difficulty is that there a lot of cfc calls and some of them are in bind expressions so the chance of making errors is high. That's why I am so anxious to find one that doesn't make me change a lot of programming. Long term I will opt for a better solution. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360025 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com wrote: try adding an Application.cfc in the root physical directory I don't that that will work. It would still be a separate application pool, and I think you need the CFID and CFTOKEN cookies to have session vars. Did a simple test on CF10 and CF8 and this does seem to work. The only identifier for an application is the application name that I'm aware of, so I would guess the first Application.cfc to be called would be the one to initialize the application. Subsequent calls would set the session and application timeouts, thus setting them the same would be a good idea. That being said, Dean's proxy suggestion is probably best, since you would probably want the code to run from either application.cfc. I thought the directory structure might be like this. The proxy would still work, but would probably just need a cfmapping to the app root so the /cfc/application.cfc could find the /app/applicationproxy.cfc. /cfc /app /app/application.cfc ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360035 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
@Dean, Looked into this a bit further on CF10. root - Application.cfc - ApplicationProxy.cfc (extends Application) - cfc-folder - - Application.cfc (extends ApplicationProxy) - - myCFC.cfc This does not work without the cfc/application.cfc having extends=root.ApplicationProxy, where 'root' is a CF mapping. As you said, CF will search from the application root downward on the file system. Since there is an Application.cfc in the cfc folder, it would start there and not find the ApplicationProxy in the directory above. This would work if the actual root directory was cfusion/wwwroot, or maybe if both application.cfc had the same applicationName and the ApplicationProxy was used/cached in /root app somehow before /root/cfc was initialized. If you use a CF mapping the proxy is really not even necessary, as this does work. /cfc/application.cfc - cfcomponent extends=root.application Cheers, Byron On Wed, Jan 28, 2015 at 3:44 PM, Dean Lawrence dean...@gmail.com wrote: Byron, the ApplicationProxy.cfc needs to be in the root directory along with the main Application.cfc. When you extend a CFC, CF will first look in the same directory to see if that CFC exist. If it doesn't CF will start looking for the CFC from the application root down. So by simply adding extends=ApplicationProxy to the Application.cfc within the /cfc directory, CF will find the ApplicationProxy.cfc in the root, which in turn finds the Application.cfc in the root. No mappings are needed. T ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360039 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
Byron, the ApplicationProxy.cfc needs to be in the root directory along with the main Application.cfc. When you extend a CFC, CF will first look in the same directory to see if that CFC exist. If it doesn't CF will start looking for the CFC from the application root down. So by simply adding extends=ApplicationProxy to the Application.cfc within the /cfc directory, CF will find the ApplicationProxy.cfc in the root, which in turn finds the Application.cfc in the root. No mappings are needed. On Wed, Jan 28, 2015 at 3:21 PM, Byron Mann byronos...@gmail.com wrote: On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com wrote: try adding an Application.cfc in the root physical directory I don't that that will work. It would still be a separate application pool, and I think you need the CFID and CFTOKEN cookies to have session vars. Did a simple test on CF10 and CF8 and this does seem to work. The only identifier for an application is the application name that I'm aware of, so I would guess the first Application.cfc to be called would be the one to initialize the application. Subsequent calls would set the session and application timeouts, thus setting them the same would be a good idea. That being said, Dean's proxy suggestion is probably best, since you would probably want the code to run from either application.cfc. I thought the directory structure might be like this. The proxy would still work, but would probably just need a cfmapping to the app root so the /cfc/application.cfc could find the /app/applicationproxy.cfc. /cfc /app /app/application.cfc ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360036 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
Hmm, that's odd as I use that setup on numerous sites and I never have to map the applicationproxy. I am currently using it on both ACF 10 and 11, but I started using this around 8 or 9 and haven't changed it for new version. I don't believe that you could use the root.(dot) notation in 8 or 9, which if I remember correctly, predicated the use of the proxy. Every site is also housed in completely different directories, nowhere near the cfusion/wwwroot directory, so I am not sure why it is didn't work for you as well. Anyway, thanks for the additional info regarding cutting out the proxy step. On Wed, Jan 28, 2015 at 4:54 PM, Byron Mann byronos...@gmail.com wrote: @Dean, Looked into this a bit further on CF10. root - Application.cfc - ApplicationProxy.cfc (extends Application) - cfc-folder - - Application.cfc (extends ApplicationProxy) - - myCFC.cfc This does not work without the cfc/application.cfc having extends=root.ApplicationProxy, where 'root' is a CF mapping. As you said, CF will search from the application root downward on the file system. Since there is an Application.cfc in the cfc folder, it would start there and not find the ApplicationProxy in the directory above. This would work if the actual root directory was cfusion/wwwroot, or maybe if both application.cfc had the same applicationName and the ApplicationProxy was used/cached in /root app somehow before /root/cfc was initialized. If you use a CF mapping the proxy is really not even necessary, as this does work. /cfc/application.cfc - cfcomponent extends=root.application Cheers, Byron On Wed, Jan 28, 2015 at 3:44 PM, Dean Lawrence dean...@gmail.com wrote: Byron, the ApplicationProxy.cfc needs to be in the root directory along with the main Application.cfc. When you extend a CFC, CF will first look in the same directory to see if that CFC exist. If it doesn't CF will start looking for the CFC from the application root down. So by simply adding extends=ApplicationProxy to the Application.cfc within the /cfc directory, CF will find the ApplicationProxy.cfc in the root, which in turn finds the Application.cfc in the root. No mappings are needed. T ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360040 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Cannot access session variables in a cfc
My app is running in a CF10 system and since I moved my cfc's out of the document root, they are losing access to the session variables. It seems that they work for around a day and then can no longer be found. I initialize them in my application.cfm to a value and I can still cfdump them in a regular web page, but the cfc fails with the error Element XXX is undefined in SESSION. Is this normal behaviour? If it is, then what is the alternative method of passing a variable into the cfc (other than making it a parameter when calling)? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360014 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
What other method than session variables can I use to pass a common variable that won't require me to include it as a parameter of every calling routine? Since you've moved your CFCs out of the application I cannot think of any other method beside passing them all as arguments. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360018 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
If you moved your cfc's above the application.cfc (or application.cfm) file, the session variables will not be accessible. Session and application vars are accessible from the application file down. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360015 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
If you moved your cfc's above the application.cfc (or application.cfm) file, the session variables will not be accessible. Session and application vars are accessible from the application file down. That's what we did. What other method than session variables can I use to pass a common variable that won't require me to include it as a parameter of every calling routine? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360016 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
You shouldn't, as it breaks encapsulation. Any outside variables you would need inside a cfc should be passed into the cfc, either as part of your object initialization, or directly into a specific method. Cutter On 1/28/2015 10:25 AM, John Pullam wrote: If you moved your cfc's above the application.cfc (or application.cfm) file, the session variables will not be accessible. Session and application vars are accessible from the application file down. That's what we did. What other method than session variables can I use to pass a common variable that won't require me to include it as a parameter of every calling routine? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360017 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
Thanx. That's what I think I will do for the time being. It is hard for me to come up with all the symptoms that we started seeing on the cfc's now and I don't think I could do justice to any explanation of those issues. It seemed to me that it was all quite normal stuff. All pages and cfc's were in the same doc root. And I have had issues with cfc locations on my test system because it gets confused with localhost and virtual directories, so getting the cfc's into a separate folder had a certain appeal. I'm planning to do a big refresh on the app over the summer and this is going to be addressed then. In the meantime, I have my fingers crossed than an application scoped variable will get us through. Thanx again. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360027 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
You shouldn't, as it breaks encapsulation Honestly, I too think you should reconsider moving the CFC out of the web root. Maybe if you moved them out then created objects from them in the application.cfc, then you may be able to use session vars, as I think the objects would still be in the application. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360020 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
You will need to pass your session variables as a parameter in order to use them in the CFC, this is best practices anyways. Good news, however, is that you can send them as a complete struct, you don't necessarily need to have them send all separately. cfargument name=sSession type=struct required=yes / Hope this helps, William -- William Seiter -Original Message- From: John Pullam [mailto:jpul...@mcleansystems.com] Sent: Wednesday, January 28, 2015 8:08 AM To: cf-talk Subject: Cannot access session variables in a cfc My app is running in a CF10 system and since I moved my cfc's out of the document root, they are losing access to the session variables. It seems that they work for around a day and then can no longer be found. I initialize them in my application.cfm to a value and I can still cfdump them in a regular web page, but the cfc fails with the error Element XXX is undefined in SESSION. Is this normal behaviour? If it is, then what is the alternative method of passing a variable into the cfc (other than making it a parameter when calling)? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360022 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
I know this isn't ideal, but it is a live application and the decision to move the cfc's outside of the doc root was taken because CF was having trouble finding them (for no obvious reason). Code that has worked since CF7 started breaking. So we moved them and this problem began. I am looking for a quick solution for now, knowing that I need to develop a better one. I'm wondering about putting the variable in the Application scope? Do the cfc's have access to that? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360021 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
Well, I'd hate to do this, but you could define an application.myvar type variable and put all the variables you need to pass in that as a structure or list, then send that variable in your arguments. That would get to one variable ... but then you're still going to need to deconstruct it before you could use them in the CFC's. Personally I think you should put your CFC's back and fix the problem that's making you move them in the first place. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360026 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
While I agree it isn't a good practice to make use of scope variables in a CFC, try adding an Application.cfc in the root physical directory of your CFCs and use the same application name and session and app timeouts. I think this would work in older versions, but not too sure about more recent versions. On Wed, Jan 28, 2015 at 11:08 AM, John Pullam jpul...@mcleansystems.com wrote: My app is running in a CF10 system and since I moved my cfc's out of the document root, they are losing access to the session variables. It seems that they work for around a day and then can no longer be found. I initialize them in my application.cfm to a value and I can still cfdump them in a regular web page, but the cfc fails with the error Element XXX is undefined in SESSION. Is this normal behaviour? If it is, then what is the alternative method of passing a variable into the cfc (other than making it a parameter when calling)? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360030 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Cannot access session variables in a cfc
try adding an Application.cfc in the root physical directory I don't that that will work. It would still be a separate application pool, and I think you need the CFID and CFTOKEN cookies to have session vars. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360031 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
You could also extend the main application.cfc. You can't do this directly if the cfc's are in a sub-directory though. If that is the case, you could use a proxy, I do this all the time. Here would be the structure. root - Application.cfc - ApplicationProxy.cfc (extends Application) - cfc-folder - - Application.cfc (extends ApplicationProxy) - - myCFC.cfc You will probably want to also call super.onApplicationStart() from within the cfc folder Application.cfc's onApplicationStart() method. The same would hold true for onSessionStart(), you would want to call super.OnSessionStart(). This ensures that all the main application and session vars get initialized properly. On Wed, Jan 28, 2015 at 1:57 PM, Robert Harrison rharri...@aimg.com wrote: try adding an Application.cfc in the root physical directory I don't that that will work. It would still be a separate application pool, and I think you need the CFID and CFTOKEN cookies to have session vars. Robert Harrison Full Stack Developer AIMG rharri...@aimg.com Main Office: 704-321-1234 ext.118 Direct Line: 516-302-4345 www.aimg.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360032 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cannot access session variables in a cfc
John, There are some pretty significant advancements to CFCs since CF 7, especially around scoping. You definitely want to look at the difference up the version chain. Cutter On 1/28/2015 12:02 PM, John Pullam wrote: Thanx. That's what I think I will do for the time being. It is hard for me to come up with all the symptoms that we started seeing on the cfc's now and I don't think I could do justice to any explanation of those issues. It seemed to me that it was all quite normal stuff. All pages and cfc's were in the same doc root. And I have had issues with cfc locations on my test system because it gets confused with localhost and virtual directories, so getting the cfc's into a separate folder had a certain appeal. I'm planning to do a big refresh on the app over the summer and this is going to be addressed then. In the meantime, I have my fingers crossed than an application scoped variable will get us through. Thanx again. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360034 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables not working
Thanks for that reminder... it's been years since I've even used cflocation! My how knowledge, unused, is fleeting... -Original Message- From: Azadi Saryev [mailto:azadi.sar...@gmail.com] Sent: Monday, February 27, 2012 9:20 PM To: cf-talk Subject: Re: Session variables not working In your cflocation tag include addtoken=no attribute to prevent CFID/CFTOKEN vars from being appended to the url. I'll also suggest you set your server to use J2EE sessions in CF Administrator, if you have not done so already. Azadi On Tue, Feb 28, 2012 at 04:36, Rick Faircloth r...@whitestonemedia.com wrote: Well, after quickly throwing together an application.cfc, I can see that it is necessary. It attached the CFID and CFTOKEN to the URL. -Original Message- From: Rick Faircloth [mailto:r...@whitestonemedia.com] Sent: Monday, February 27, 2012 3:29 PM To: cf-talk Subject: RE: Session variables not working There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350125 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables not working
I normally use an application.cfc, but this was just a quick proof-of-concept that I threw together to test something. -Original Message- From: James Holmes [mailto:james.hol...@gmail.com] Sent: Monday, February 27, 2012 10:56 PM To: cf-talk Subject: Re: Session variables not working Actually, a cfapplication tag will work fine outside of Application.cfm so technically this isn't true. Of course it makes sense to use Application.cfm or Application.cfc. -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 28 February 2012 04:36, Russ Michaels r...@michaels.me.uk wrote: yes you must have an application.cfm/cfc in order to enable session variables. On Mon, Feb 27, 2012 at 8:28 PM, Rick Faircloth r...@whitestonemedia.com wrote: There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350126 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables not working
Thanks, Jay! Rick -Original Message- From: Jay Pandya [mailto:jaypandy...@gmail.com] Sent: Tuesday, February 28, 2012 12:49 AM To: cf-talk Subject: Re: Session variables not working Hi Rick, When you are using session variables and you want to get its value in other page after using cflocation then you need to enable seclientcookies true in cfapplication tag. More description you can read on http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_5 .html read Setclientcokies description. Thank You Jay Pandya It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350127 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Session variables not working
It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350108 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350110 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables not working
There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350112 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
yes you must have an application.cfm/cfc in order to enable session variables. On Mon, Feb 27, 2012 at 8:28 PM, Rick Faircloth r...@whitestonemedia.comwrote: There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350114 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables not working
Well, after quickly throwing together an application.cfc, I can see that it is necessary. It attached the CFID and CFTOKEN to the URL. -Original Message- From: Rick Faircloth [mailto:r...@whitestonemedia.com] Sent: Monday, February 27, 2012 3:29 PM To: cf-talk Subject: RE: Session variables not working There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350115 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
You will need an application.cfc (or .cfm) for session variables to work. In your example, your cfset session.name = 'rick' was actually stored in the variables scope on that page as variables.session.rick, and not actually in the session scope. That is why it was not available on the other page. On Mon, Feb 27, 2012 at 3:28 PM, Rick Faircloth r...@whitestonemedia.comwrote: There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350116 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
Correction on my previous post: The variable was stored in variables.session.name (not variables.session.rick)... but you probably knew what I meant.. ;-) On Mon, Feb 27, 2012 at 3:39 PM, Steve Milburn scmilb...@gmail.com wrote: You will need an application.cfc (or .cfm) for session variables to work. In your example, your cfset session.name = 'rick' was actually stored in the variables scope on that page as variables.session.rick, and not actually in the session scope. That is why it was not available on the other page. On Mon, Feb 27, 2012 at 3:28 PM, Rick Faircloth r...@whitestonemedia.comwrote: There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350117 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables not working
Thanks for the reminder! Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:42 PM To: cf-talk Subject: Re: Session variables not working Correction on my previous post: The variable was stored in variables.session.name (not variables.session.rick)... but you probably knew what I meant.. ;-) On Mon, Feb 27, 2012 at 3:39 PM, Steve Milburn scmilb...@gmail.com wrote: You will need an application.cfc (or .cfm) for session variables to work. In your example, your cfset session.name = 'rick' was actually stored in the variables scope on that page as variables.session.rick, and not actually in the session scope. That is why it was not available on the other page. On Mon, Feb 27, 2012 at 3:28 PM, Rick Faircloth r...@whitestonemedia.comwrote: There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350119 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
In your cflocation tag include addtoken=no attribute to prevent CFID/CFTOKEN vars from being appended to the url. I'll also suggest you set your server to use J2EE sessions in CF Administrator, if you have not done so already. Azadi On Tue, Feb 28, 2012 at 04:36, Rick Faircloth r...@whitestonemedia.com wrote: Well, after quickly throwing together an application.cfc, I can see that it is necessary. It attached the CFID and CFTOKEN to the URL. -Original Message- From: Rick Faircloth [mailto:r...@whitestonemedia.com] Sent: Monday, February 27, 2012 3:29 PM To: cf-talk Subject: RE: Session variables not working There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350120 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
Actually, a cfapplication tag will work fine outside of Application.cfm so technically this isn't true. Of course it makes sense to use Application.cfm or Application.cfc. -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 28 February 2012 04:36, Russ Michaels r...@michaels.me.uk wrote: yes you must have an application.cfm/cfc in order to enable session variables. On Mon, Feb 27, 2012 at 8:28 PM, Rick Faircloth r...@whitestonemedia.com wrote: There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: cfset session.name = 'rick' and then output that with: cfoutput#session.name#/cfoutput I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick -Original Message- From: Steve Milburn [mailto:scmilb...@gmail.com] Sent: Monday, February 27, 2012 3:18 PM To: cf-talk Subject: Re: Session variables not working Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth r...@whitestonemedia.comwrote: It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350121 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables not working
Hi Rick, When you are using session variables and you want to get its value in other page after using cflocation then you need to enable seclientcookies true in cfapplication tag. More description you can read on http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_5.html read Setclientcokies description. Thank You Jay Pandya It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm cfset session.name = 'rick' cfoutput#session.name#/cfoutput cflocation url=session-test-2.cfm session-test-2.cfm -- cfoutput#session.name#/cfoutput I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350123 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
On Thu, Feb 2, 2012 at 10:22 AM, Raymond Camden raymondcam...@gmail.com wrote: I'd also argue that sometimes race conditions may not matter. On project I've worked on, this is true 99.9% of the time. Consider a session variable that tracks the # of pages you have viewed in your session. If I pop open a new tab and start reloading them both like crazy, it's possible the values may end up borked. But do we care? No. If it's just a simple stat and it's not perfect, then I'd ignore the hassle of locking the write/reads. ...and this is a pretty unusual use case with all the analytics packages out there. Really, I have a pretty hard time thinking of a good use case with race conditions that goes beyond a contrived impractical example. Banking maybe? Though in most cases I'd going to be doing much of that type of work in the DB and even if I'm not, it's probably going to be in a scope that doesn't live past a single request. Most of the examples I see are things that shouldn't be using the Session scope at all anyway. Of course, folks are free write their apps any way they want, but I just don't see it as a problem. I very very very rarely lock (or have need to lock) session vars. I don't think I've personally found reason in any project I've worked on since CF5. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349765 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
...and this is a pretty unusual use case with all the analytics packages out there. Really, I have a pretty hard time thinking of a good use case with race conditions that goes beyond a contrived impractical example. Someone on cf-talk had a race condition just last week, around their authentication process. Of course, it was because of how their code was structured, and probably didn't need CFLOCK to resolve. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349766 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
On Fri, Feb 3, 2012 at 11:03 AM, Dave Watts dwa...@figleaf.com wrote: ...and this is a pretty unusual use case with all the analytics packages out there. Really, I have a pretty hard time thinking of a good use case with race conditions that goes beyond a contrived impractical example. Someone on cf-talk had a race condition just last week, around their authentication process. Of course, it was because of how their code was structured, and probably didn't need CFLOCK to resolve. Race conditions certainly exist. Specifically though, race conditions involving session variables which can be resolved using CFLOCK, are relatively uncommon. In my personal experience anyway... -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349767 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
...and this is a pretty unusual use case with all the analytics packages out there. Really, I have a pretty hard time thinking of a good use case with race conditions that goes beyond a contrived impractical example. Someone on cf-talk had a race condition just last week, around their authentication process. Of course, it was because of how their code was structured, and probably didn't need CFLOCK to resolve. Race conditions certainly exist. Specifically though, race conditions involving session variables which can be resolved using CFLOCK, are relatively uncommon. In my personal experience anyway... I'm not sure I'm disagreeing with you. Most race conditions that I see can be resolved without CFLOCK, but not all - specifically around components used during authentication/user initialization/etc. The primary reason for them seems to be that developers just don't think about concurrency. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349768 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
Race conditions certainly exist. Specifically though, race conditions involving session variables which can be resolved using CFLOCK, are relatively uncommon. In my personal experience anyway... +! In my experience anything that would really be effected by race conditions shouldn't be in session scope to begin with. Mary Jo ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349769 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
On Fri, Feb 3, 2012 at 12:10 PM, Dave Watts dwa...@figleaf.com wrote: I'm not sure I'm disagreeing with you. Most race conditions that I see can be resolved without CFLOCK, but not all - specifically around components used during authentication/user initialization/etc. The primary reason for them seems to be that developers just don't think about concurrency. Agreed. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349771 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
On Wed, Feb 1, 2012 at 7:37 PM, James Holmes james.hol...@gmail.com wrote: Race conditions in session variables can only occur when two requests from the same session execute concurrently. This is more likely with ajax requests or framesets. Since everyone uses ajax requests these days (even though no-one uses framesets any more), it is still an issue, as you say. This can be true, depending on the situation and how you are using the session scope. However, untrue is the old adage of always lock your session variables. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349743 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I'd also argue that sometimes race conditions may not matter. Consider a session variable that tracks the # of pages you have viewed in your session. If I pop open a new tab and start reloading them both like crazy, it's possible the values may end up borked. But do we care? No. If it's just a simple stat and it's not perfect, then I'd ignore the hassle of locking the write/reads. On Thu, Feb 2, 2012 at 7:11 AM, Cameron Childress camer...@gmail.com wrote: On Wed, Feb 1, 2012 at 7:37 PM, James Holmes james.hol...@gmail.com wrote: Race conditions in session variables can only occur when two requests from the same session execute concurrently. This is more likely with ajax requests or framesets. Since everyone uses ajax requests these days (even though no-one uses framesets any more), it is still an issue, as you say. This can be true, depending on the situation and how you are using the session scope. However, untrue is the old adage of always lock your session variables. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349745 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
of course for a newbie that has no idea what a race condition is, in todays PC society they might take that as an insult :-) On Thu, Feb 2, 2012 at 3:22 PM, Raymond Camden raymondcam...@gmail.comwrote: I'd also argue that sometimes race conditions may not matter. Consider a session variable that tracks the # of pages you have viewed in your session. If I pop open a new tab and start reloading them both like crazy, it's possible the values may end up borked. But do we care? No. If it's just a simple stat and it's not perfect, then I'd ignore the hassle of locking the write/reads. On Thu, Feb 2, 2012 at 7:11 AM, Cameron Childress camer...@gmail.com wrote: On Wed, Feb 1, 2012 at 7:37 PM, James Holmes james.hol...@gmail.com wrote: Race conditions in session variables can only occur when two requests from the same session execute concurrently. This is more likely with ajax requests or framesets. Since everyone uses ajax requests these days (even though no-one uses framesets any more), it is still an issue, as you say. This can be true, depending on the situation and how you are using the session scope. However, untrue is the old adage of always lock your session variables. -Cameron -- Cameron Childress -- p: 678.637.5072 im: cameroncf facebook http://www.facebook.com/cameroncf | twitterhttp://twitter.com/cameronc | google+ https://profiles.google.com/u/0/117829379451708140985 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349752 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
in the case I was referring to Dave, there was no locking, and it was copying all scopes into sessions (variables, url and form) and then back again so it really was for no good reason :-) however all programmers work different and have a tendency to slate the way others have done things, thus why I suggested it would be better to just ask him rather than make assumptions.Most of time we don;t have this option as the original developer has long since gone. On Wed, Feb 1, 2012 at 3:58 AM, Dave Watts dwa...@figleaf.com wrote: I have come across some similar code also, moving variables scope into sessions and back again for no reason. There's actually a reason why that might be, in some cases. Not a good reason, but a reason nonetheless. It used to be the case (CF 5 and earlier) that you had to worry about locking a lot more than you do now. So, people would do something like this: !-- top of page -- cflock scope=session ... cfset variables.localsession = session /cflock ... do a bunch of stuff with those variables ... !-- bottom of page -- cflock scope=session ... cfset session = variables.localsession /cflock Unfortunately, it didn't work very well in practice. perhaps you could just ask him why he is doing it. I am not being sarcastic when I say this - this is a very good suggestion. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349694 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I would agree with what some others have written, in that an apparent over-use of session variables is not inherently bad, unless it is causing server instability or memory problems. Make sure the programmer is using session variables for a specific reason, and that he is aware of the issues that using session variables can cause. Out of all the faults one can find when examining a Web site, using too many session variables is fairly low on the priority list. 1000 users on a site at a time with 250 session variables per user doesn't seem that bad to me on the surface. Storing frequently accessed database data in the session scope is often used as a caching optimization technique to reduce the database bottleneck. It is a technique I use and recommend, especially for very busy Web applications. In general, the busier the Web application, the more you are going to want to store in-memory to reduce the database usage, assuming your server has sufficient RAM. Really giant Web sites, like Facebook and YouTube, make extensive use of in-memory databases, like memcached. http://en.wikipedia.org/wiki/Memcached One thing most developers neglect to do when using lots of session variables is making the session code thread safe, which takes a relatively high skill and experience level to accomplish. Unless you see a lot of cflock tags to mitigate the possible problems, a site with 1000 simultaneous users and 250 session variables might have random problems that could be traced back to the use of session variables. Threading problems can be hard to diagnose and are usually not discovered until the code gets put into a production environment. If the programmer is aware of the memory usage and threading issues, using lots of session variables is likely a minor concern, and potentially is a good thing if he is using them as a technique to speed up the Web application. You wrote I see no scope referencing in these Vars, which I find odd if you are referring to variables in the session scope. All the in-memory variables should have their scope referenced when they are used. -Mike Chabot On Tue, Jan 31, 2012 at 11:37 AM, Robert Harrison rob...@austin-williams.com wrote: Thanks for all the input. Besides the fact that the application could conceivably have hundreds of thousands of session Vars in memory, I'm concerned about collision too. I see no scope referencing in these Vars and see they are all 'common names'. I also see no routines to clear any vars after completion of an operation is over. Oh well. Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.co ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349723 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
On Wed, Feb 1, 2012 at 1:55 PM, Mike Chabot mcha...@gmail.com wrote: One thing most developers neglect to do when using lots of session variables is making the session code thread safe, which takes a relatively high skill and experience level to accomplish. Unless you see a lot of cflock tags to mitigate the possible problems, a site with 1000 simultaneous users and 250 session variables might have random problems that could be traced back to the use of session variables. This is largely false since the release of CF6. Race conditions being the primary exception. -Cameron ... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349724 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
Fyi cf officially did away with need for manual locking some time ago. The only sitation where you need to lock now is where you have potential race conditions. Some folks still like to lock anyway though. Regards Russ Michaels From my mobile On 1 Feb 2012 18:57, Mike Chabot mcha...@gmail.com wrote: I would agree with what some others have written, in that an apparent over-use of session variables is not inherently bad, unless it is causing server instability or memory problems. Make sure the programmer is using session variables for a specific reason, and that he is aware of the issues that using session variables can cause. Out of all the faults one can find when examining a Web site, using too many session variables is fairly low on the priority list. 1000 users on a site at a time with 250 session variables per user doesn't seem that bad to me on the surface. Storing frequently accessed database data in the session scope is often used as a caching optimization technique to reduce the database bottleneck. It is a technique I use and recommend, especially for very busy Web applications. In general, the busier the Web application, the more you are going to want to store in-memory to reduce the database usage, assuming your server has sufficient RAM. Really giant Web sites, like Facebook and YouTube, make extensive use of in-memory databases, like memcached. http://en.wikipedia.org/wiki/Memcached One thing most developers neglect to do when using lots of session variables is making the session code thread safe, which takes a relatively high skill and experience level to accomplish. Unless you see a lot of cflock tags to mitigate the possible problems, a site with 1000 simultaneous users and 250 session variables might have random problems that could be traced back to the use of session variables. Threading problems can be hard to diagnose and are usually not discovered until the code gets put into a production environment. If the programmer is aware of the memory usage and threading issues, using lots of session variables is likely a minor concern, and potentially is a good thing if he is using them as a technique to speed up the Web application. You wrote I see no scope referencing in these Vars, which I find odd if you are referring to variables in the session scope. All the in-memory variables should have their scope referenced when they are used. -Mike Chabot On Tue, Jan 31, 2012 at 11:37 AM, Robert Harrison rob...@austin-williams.com wrote: Thanks for all the input. Besides the fact that the application could conceivably have hundreds of thousands of session Vars in memory, I'm concerned about collision too. I see no scope referencing in these Vars and see they are all 'common names'. I also see no routines to clear any vars after completion of an operation is over. Oh well. Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.co ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349725 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
Race conditions are what I am referring to and they are a problem, even in CF9. Many developers either heard or read that the earlier problems with session variables have been fixed and that they no longer need to ever lock them, but this is not true. It is one of the most common CF misconceptions, even among experienced CF programmers. The problem generally only shows up on high-traffic data intensive sites, but even with 1000 simultaneous users and 250 session variables I would expect that the application will at some point have a seemingly random and rare issue when updating large structures of session variables or processing giant form submissions that could ultimately be traced back to a race condition where competing code execution process are accessing the same shared resource on different threads. The cflock tag still exists, and it is usually not used as frequently as it needs to be used, which is why I mentioned the problem. The use of the cflock tag is not simply a matter of preference. It solves an actual problem related to the multi-threaded code accessing shared resources, such as session variables. From the CF9 manual: ColdFusion lets you lock access to sections of code to ensure that ColdFusion does not attempt to run the code, or access the data that it uses, simultaneously or in an unpredictable order. This locking feature is important for ensuring the consistency of all shared data, including data in external sources in addition to data in persistent scopes. I think many developers would prefer to ignore the issue because locking isn't fun and race conditions are a challenging issue to understand. -Mike Chabot On Wed, Feb 1, 2012 at 3:03 PM, Cameron Childress camer...@gmail.com wrote: This is largely false since the release of CF6. Race conditions being the primary exception. -Cameron ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349728 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
Race conditions in session variables can only occur when two requests from the same session execute concurrently. This is more likely with ajax requests or framesets. Since everyone uses ajax requests these days (even though no-one uses framesets any more), it is still an issue, as you say. -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 2 February 2012 05:53, Mike Chabot mcha...@gmail.com wrote: Race conditions are what I am referring to and they are a problem, even in CF9. Many developers either heard or read that the earlier problems with session variables have been fixed and that they no longer need to ever lock them, but this is not true. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349733 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
In addition to AJAX (and Flex/Flash remoting calls) and framesets (and iframes), issues with session variables can also occur if a user has two separate browser tabs open, double clicks links or form submit buttons (some users double click everything), rapidly and repeatedly presses a submit button or the refresh button because a page is slow to load, submits a form, then makes a quick change before the form disappears from the screen, and submits again, requests a page but presses the browser back button before the page loads, rapidly toggles through multiple pages using a fast-loading navigation element (possibly controlled by a URL variable), starts running a page that takes so long to process that they hit the browser timeout before the code finishes processing, so they run it again, and likely some other scenarios. -Mike Chabot On Wed, Feb 1, 2012 at 7:37 PM, James Holmes james.hol...@gmail.com wrote: Race conditions in session variables can only occur when two requests from the same session execute concurrently. This is more likely with ajax requests or framesets. Since everyone uses ajax requests these days (even though no-one uses framesets any more), it is still an issue, as you say. -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 2 February 2012 05:53, Mike Chabot mcha...@gmail.com wrote: Race conditions are what I am referring to and they are a problem, even in CF9. Many developers either heard or read that the earlier problems with session variables have been fixed and that they no longer need to ever lock them, but this is not true. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349736 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Opinion: Abuse of session variables
I'm an old school programmer who watches every bit and byte and really practices resource management in my coding practices. I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Am I nuts, or is this just bad? Thanks, Robert Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be . Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349680 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
It depends. It could be no big deal, but it definitely sounds like there is a significant risk of oops! there goes the server!. As a general rule, you are correct: keep the session as lean as possible. More specifically, don't use it unless there is a damn good reason to do so. Maybe it's time to have a best practices or our standards are: type of conversation. HTH On Tue, Jan 31, 2012 at 10:01 AM, Robert Harrison rob...@austin-williams.com wrote: I'm an old school programmer who watches every bit and byte and really practices resource management in my coding practices. I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Am I nuts, or is this just bad? Thanks, Robert Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be . Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349681 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
On Tue, Jan 31, 2012 at 5:01 PM, Robert Harrison rob...@austin-williams.com wrote: I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Your primary concern should not be the memory usage implications of this practice, but the functional implications. What does it mean for the correctness of your application? Can you still navigate the site with multiple tabs opened if everything goes into the session scope or do you get weird results on some pages because session variables get overwritten from elsewhere? Only after you are certain the code is functionally correct memory optimizations come into play Jochem -- Jochem van Dieten http://jochem.vandieten.net/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349682 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
As a general rule in life, I believe, everything in moderation - The extremes on either side will always get you into trouble. Modern servers have tons of RAM, session vars, especially vars that are just strings, are pretty light weight. It's hard to imagine making common senses use of them causing issues with the server. However, on the other side, if you got a guy storing every moment of every customer interaction in a session struct, you've got the definite potential for problems. Based on what you've told us, it sounds like this guy might have some architectural problems in his designs for you apps. I'd start with him by going over the realistic use cases for the data he is storing. It's likely he has a good reason for storing huge forms in the session(there are plenty of reasons to do that) - but maybe you need to look at how long those vals need to be persisted - if they need to be, I'd move them to a temp database and just carry a reference to the vals in the DB in their session. =] -- Alan Rother Manager, Phoenix Cold Fusion User Group, www.AZCFUG.org Twitter: @AlanRother ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349683 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I generally would keep the variable as long as you need it and no longer. If it's just needed for the request, there is no reason at all it should be in the session scope. Performance is a concern, but so is data leaking from page to page. If you're putting alot in session and not paying attention to the names then you may end up stepping on variables as you go. At the least, if they are needed for a multipart form (for example) then he should be clearing (structDelete()) the variables when they are no longer needed. Better yet, put then in a struct in session and just nuke that struct when you're done with it. IF you have: session.myform.firstname session.myform.lastname session.myform.phone Then when you are done just do a little structDelete(session,'myform') action and your session is all clean again. -Cameron On Tue, Jan 31, 2012 at 11:01 AM, Robert Harrison rob...@austin-williams.com wrote: I'm an old school programmer who watches every bit and byte and really practices resource management in my coding practices. I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Am I nuts, or is this just bad? Thanks, Robert Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be . Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349684 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Opinion: Abuse of session variables
Thanks for all the input. Besides the fact that the application could conceivably have hundreds of thousands of session Vars in memory, I'm concerned about collision too. I see no scope referencing in these Vars and see they are all 'common names'. I also see no routines to clear any vars after completion of an operation is over. Oh well. Robert B. Harrison Director of Interactive Services Austin Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be . Plug in to our blog: AW Unplugged http://www.austin-williams.com/unplugged ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349685 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I think I ran across that guy once (lol). IMO, loading anything other the absolute minimum required info to identify a unique session into session variables is bad coding practice. On Tue, Jan 31, 2012 at 8:01 AM, Robert Harrison rob...@austin-williams.com wrote: I'm an old school programmer who watches every bit and byte and really practices resource management in my coding practices. I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Am I nuts, or is this just bad? Thanks, Robert ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349687 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I have come across some similar code also, moving variables scope into sessions and back again for no reason. if the data has no reason to persist past the request then there is no reason to put it in session scope. the primary reason for doing it with forms is to persist the form data so users can come back later and their data is still there, such as when a form is split across multiple pages.. perhaps you could just ask him why he is doing it. On Tue, Jan 31, 2012 at 8:24 PM, Maureen mamamaur...@gmail.com wrote: I think I ran across that guy once (lol). IMO, loading anything other the absolute minimum required info to identify a unique session into session variables is bad coding practice. On Tue, Jan 31, 2012 at 8:01 AM, Robert Harrison rob...@austin-williams.com wrote: I'm an old school programmer who watches every bit and byte and really practices resource management in my coding practices. I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Am I nuts, or is this just bad? Thanks, Robert ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349689 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I've got a new programmer working for me (on contract) and I'm finding he's using session Vars all over the place. He creating session Vars on forms that have a hundred fields, he putting arrays into session Vars, etc. I just went through a few of the programs he wrote and used them, then I dumped my session vars and found I had over 250 session vars from just using a few programs. Considering the site has over 1,000 users on it at any given moment, I'm very concerned about this practice. Am I nuts, or is this just bad? There are several possibilities: 1. You are nuts, and this is just bad. 2. You are nuts, and this is not bad. 3. You are not nuts, and this is just bad. 4. You are not nuts, but this is not bad. The problem is, we don't have enough information to answer your question. We cannot accurately determine whether you're nuts, or whether this is bad. There's nothing inherently inappropriate about storing arrays in session scope, or submitted form fields, etc. It depends (as Jochem pointed out) on what your application is intended to do, and the potential use-case scenarios around your application. While memory is limited, it's much more efficient to store things in memory rather than refetch them from a database - database interactivity is typically the most expensive portion of an application. If you had unlimited memory at your disposal, it would make perfect sense to just store everything in there until you absolutely have to write it to a persistent data store. But you don't have unlimited memory, so you have a balancing act. We all would need far more information than you've provided to tell you whether you're off-balance one way or the other. I will say this, though - there's a reason we have 64-bit servers nowadays. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349691 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
IMO, loading anything other the absolute minimum required info to identify a unique session into session variables is bad coding practice. What does that mean? The absolute minimum required info to identify a unique session would be the session ID. Are you saying any other use of session variables is bad practice? If so, I'll have to disagree with that pretty strenuously. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349692 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Opinion: Abuse of session variables
I have come across some similar code also, moving variables scope into sessions and back again for no reason. There's actually a reason why that might be, in some cases. Not a good reason, but a reason nonetheless. It used to be the case (CF 5 and earlier) that you had to worry about locking a lot more than you do now. So, people would do something like this: !-- top of page -- cflock scope=session ... cfset variables.localsession = session /cflock ... do a bunch of stuff with those variables ... !-- bottom of page -- cflock scope=session ... cfset session = variables.localsession /cflock Unfortunately, it didn't work very well in practice. perhaps you could just ask him why he is doing it. I am not being sarcastic when I say this - this is a very good suggestion. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349693 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Lost SESSION variables - sometimes
Thanks. I'll try that. -Original Message- From: Russ Michaels [mailto:r...@michaels.me.uk] Sent: Friday, December 30, 2011 7:05 PM To: cf-talk Subject: Re: Lost SESSION variables - sometimes it is probably a cookie issue as this is how the session is tracked. clear the cookies and cache on that browser and see if it helps. Also make sure cookies are not disabled. On Fri, Dec 30, 2011 at 7:26 PM, Stephens, Larry V steph...@indiana.eduwrote: CF8 My home page populates a session variable. I did a dump to make sure this was happening. Mozilla (Firefox) - newest download On one machine I go to another page off my menu and it displays correctly. I go to another machine and I get an error - no session variable defined. The entire SESSION scope is lost on this machine. IE - works fine on both machines. I don't see how it can be a coding issue since it works in IE and in Mozilla on other machines. Does anyone have a clue why certain iterations of Firefox would cause the loss of the SESSION variable? Larry Stephens ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349296 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Lost SESSION variables - sometimes
CF8 My home page populates a session variable. I did a dump to make sure this was happening. Mozilla (Firefox) - newest download On one machine I go to another page off my menu and it displays correctly. I go to another machine and I get an error - no session variable defined. The entire SESSION scope is lost on this machine. IE - works fine on both machines. I don't see how it can be a coding issue since it works in IE and in Mozilla on other machines. Does anyone have a clue why certain iterations of Firefox would cause the loss of the SESSION variable? Larry Stephens ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349264 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Lost SESSION variables - sometimes
it is probably a cookie issue as this is how the session is tracked. clear the cookies and cache on that browser and see if it helps. Also make sure cookies are not disabled. On Fri, Dec 30, 2011 at 7:26 PM, Stephens, Larry V steph...@indiana.eduwrote: CF8 My home page populates a session variable. I did a dump to make sure this was happening. Mozilla (Firefox) - newest download On one machine I go to another page off my menu and it displays correctly. I go to another machine and I get an error - no session variable defined. The entire SESSION scope is lost on this machine. IE - works fine on both machines. I don't see how it can be a coding issue since it works in IE and in Mozilla on other machines. Does anyone have a clue why certain iterations of Firefox would cause the loss of the SESSION variable? Larry Stephens ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349272 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Session Variables
cfapplication name=newapp sessionmanagement=yes sessiontimeout=#CreateTimeSpan(14,0,0,0)# My session expires in as little as 20 minutes, I dont understand why so early when I set the timeout for 14 days. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348201 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session Variables
What is the maximum time-out period defined for memory variables on your server? By default session variables have a maximum timeout period of 20 minutes. You can manually specify a timeout of something less than that value, but nothing more. If you want your sessions to timeout in 14 days, then you have to change the maximum timeout values on your server to something = 14 days. Steve On Tue, Oct 18, 2011 at 1:32 PM, Rick T rtuinenb...@gmail.com wrote: cfapplication name=newapp sessionmanagement=yes sessiontimeout=#CreateTimeSpan(14,0,0,0)# My session expires in as little as 20 minutes, I dont understand why so early when I set the timeout for 14 days. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348203 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session Variables
Rick, What is your applicationtimeout set to? If it's set to 20 minutes, it will clear your session cache as well (I think). Also, check your application and session timeout settings in CF Admin. HTH, Carl On 10/18/2011 10:32 AM, Rick T wrote: cfapplication name=newapp sessionmanagement=yes sessiontimeout=#CreateTimeSpan(14,0,0,0)# My session expires in as little as 20 minutes, I dont understand why so early when I set the timeout for 14 days. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348204 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session Variables
Thanks guys! cfapplication name=newapp sessionmanagement=yes sessiontimeout=#CreateTimeSpan(14,0,0,0)# My session expires in as little as 20 minutes, I dont understand why so early when I set the timeout for 14 days. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348207 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session Variables
By default session variables have a maximum timeout period of 20 minutes. You can manually specify a timeout of something less than that value, but nothing more. If you want your sessions to timeout in 14 days, then you have to change the maximum timeout values on your server to something = 14 days. This is almost certainly the right answer, but in addition - you should reconsider doing this in the first place. Session variables are not designed to be persisted for 14 days. There's a very good reason why they expire after 20 minutes of inactivity by default. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348212 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session Variables
+1 as Dave said. it seems what you really want is probably a remember me function that keeps users logged in, this will simply save a cookie with an encrypted copy of their username/password and log them in again when the session expires. If you specifically want to store the session data for 14 days, then just dump it in the database and load it whenever they login. -- Russ Michaels www.bluethunderinternet.com : Business hosting services solutions www.cfmldeveloper.com : ColdFusion developer community www.michaels.me.uk : my blog www.cfsearch.com : ColdFusion search engine sky ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348213 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
Hi guys, just came in this morning. thanks for the responses will try out the suggested code and get back to you. I'm on CF9/Fusebox 5.5 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342189 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
Thanks Matt your suggestion worked. cfset session.myvariable = duplicate(form) / cflocation url=foo.cfm / Odd this is the first time I've encountered this specific behaviour in Coldfusion. Thanks a byunch was spinning my wheels on this. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342190 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
Cool beans. Always glad to help. Thanks for reporting back. :-) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342198 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
Presumably you are doing something like so... cfset session.myvariable = form / cflocation url=foo.cfm / I have not tested it, but I am guessing that you are loosing the session variables because you are creating a _reference_ to the form scope. When you redirect, the form scope is now empty, and therefore, any and all references to it will be empty. To create a session variable that actually holds the *value* (rather than the reference), use duplicate(). cfset session.myvariable = duplicate(form) / cflocation url=foo.cfm / This is not how references work. You can safely create a reference to the form (which is itself just a reference) and when the form goes out of scope, the reference you subsequently created will still be available. There's no need to use Duplicate here, and it's unnecessarily expensive. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsit ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342173 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
Dave, as you well know I usually agree with you. However, in this case, I do not agree with you at all. Why? Because you are 100% wrong in your statement. What I showed is **exactly** how references work. 1) If you create a _reference_ to something as my code example did... cfset session.myvariable = form / 2) and then you change the original... cflocation url=foo.cfm / 3) the reference **will** be updated to match the value to which it is pointing at. In ColdFusion, structures are passed _by reference_ rather than _by value_. The only way to pass a structure in CF by reference is by using duplicate(). Can it be an expensive operation? Ayep. Is it necessary when you want to pass by value rather than reference? Ayep. The 'form' scope, like all others in CF, is a structure. Therefore the rules about reference and value apply to it just as though you had created the structure yourself with structNew(). Test the code I wrote. You'll see that I am right. Now then, if you are setting your session values like so... cfscript session.myvariable = {}; for ( key IN form ) { session.myvariable[key] = form[key]; } /cfscript ... then you are creating brand new variables that will are _value_ based rather than simply a reference to the form scope. If this is what you are doing, then, of course, changing the form scope (of form-scoped variables) will have no bearing on the session variables you created. HTH ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342174 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
On Sun, Feb 13, 2011 at 11:36 AM, Matt Quackenbush wrote: The only way to pass a structure in CF by reference is by using duplicate(). Oops. That is suppose to say The only way to pass a structure in CF by value is by using duplicate(). ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342175 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
On Sun, Feb 13, 2011 at 9:36 AM, Matt Quackenbush quackfu...@gmail.com wrote: Dave, as you well know I usually agree with you. However, in this case, I do not agree with you at all. Why? Because you are 100% wrong in your statement. What I showed is **exactly** how references work. Well, yes, your code was about references but unfortunately form scope is created anew on each request in ACF so whilst cfset session.myvariable = form / leaves session.myvariable pointing at a struct (that was the form scope on that request), by the time you do this: cflocation url=foo.cfm / The name form is bound to a new struct and the original session.myvariable is unchanged. I tried it on Railo and discovered that the form scope is somehow reused across multiple requests - so on Railo, your logic would be correct. That's interesting and I'll have to take that up with engineering to find out why / how it's different. Which begs the question of the Original Poster: Don / Dan - are you running on ACF or Railo? -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret At ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342184 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
On Sun, Feb 13, 2011 at 7:59 PM, Sean Corfield seancorfi...@gmail.com wrote: I tried it on Railo and discovered that the form scope is somehow reused across multiple requests - so on Railo, your logic would be correct. That's interesting and I'll have to take that up with engineering to find out why / how it's different. Some experimentation yields the answer. In ACF, form is a fairly regular struct object that is created and populated afresh on each request with whatever is posted into that request. In Railo, form is a smart object that behaves like a proxy to the current request's form data so, whilst the contents of the form scope are populated afresh on each request, the form scope itself is a proxy to that data rather than actually containing it. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342185 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
I have two different CF9 installations that behave the way I described. It actually caught me out on a quickie application I did for someone awhile back, because I did not expect that behavior. But that's exactly what it does on two different installations. shrug ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342186 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
On Sun, Feb 13, 2011 at 8:58 PM, Matt Quackenbush quackfu...@gmail.com wrote: I have two different CF9 installations that behave the way I described. Odd. I couldn't repro on CF9.0.1 locally. Do you have a small test case that shows form scope behaving like that for you? I'd love to try it on my setup. Thanx! -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342187 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Fusebox seemingly clearing contents of session variables on relocation
I have some code where I am transferring the contents of a form submission into a session variable. According to some cfdumps, the form variables do get set in session. but after the cflocation redirect, the session variables are there but empty. Any ideas? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342166 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Fusebox seemingly clearing contents of session variables on relocation
Presumably you are doing something like so... cfset session.myvariable = form / cflocation url=foo.cfm / I have not tested it, but I am guessing that you are loosing the session variables because you are creating a _reference_ to the form scope. When you redirect, the form scope is now empty, and therefore, any and all references to it will be empty. To create a session variable that actually holds the *value* (rather than the reference), use duplicate(). cfset session.myvariable = duplicate(form) / cflocation url=foo.cfm / HTH ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342171 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables security
No I haven't used it, and I am in a closed environment where I don't need to worry about these things to much. However, I brought it up because some people find that it would cost them more to try to match the features, than to actually buy it. Regards, Andrew Scott http://www.andyscott.id.au/ -Original Message- From: Rob Voyle [mailto:robvo...@voyle.com] Sent: Wednesday, 26 January 2011 5:09 PM To: Andrew Scott; cf-talk@houseoffusion.com Subject: Re: Session variables security Hi Andrew have you used this firewall or others that are out there? I find I have a great hesitancy about proprietry add ons, as an old engineer I like/d to work from first principles. I have had more problems and time wasted from firewalls and antivirus programs than they are supposed to prevent. Once I get a basic process established it is not much of a problem to add it to the pages I am using. Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341321 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables security
Hi Folks I have several large forms connected to mySql tables. I use cfqueryparam when querying and inserting data from the form after it has been validated for content that I need (no blank fields etc.) I created the following validation to check for scripts etc being injected. Is there anything else I should check for that would indicate someone was hacking the page. Thanks Rob cfloop index=checkVariables list=#user#, #upDate#, #parts#, #workshopCode1#, #workshopCode2#, #workshopCode3#, #programCode# delimiters = , cfif REFind('[~^*+={}|\\/\[\]]', checkVariables) cfset badCharacter=yes cfset errorData=h3You have an illegal character ~^*+={}|\/ in one of the fields/h3 /cfif cfif REFindNoCase('onClick|onDblClick|onKeyDown|onKeyPress|onKeyUp|onMouseDo wn|onMouseOut|onMouseUp|onMouseOver| onBlur|onChange|onFocus|onSelect', checkVariables) cfset badEvent=yes cfset errorData=h3You have an illegal event in one of the fields/h3 /cfif cfif REFindNoCase('script|object|applet|embed|form|layer|frame|frameset|param|m eta|.exe|.bat', checkVariables) cfset badAction=yes cfset errorData=h3You have an illegal action script, object, applet, embed, form, layer, frame in one of the fields/h3 /cfif cfif REFindNoCase('append|delete|char|declare|cast|execute|sp_sqlExecute|select|in sert|update|drop|alter', checkVariables) cfset badSql=yes cfset errorData=h3You have an illegal database action append, delete, declare, cast, execute, sp_sqlExecute, select, insert, update, drop, alter in one of the fields/h3 /cfif /cfloop ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341240 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Session variables security
I am wondering if it would be cheaper for you to take a look at http://www.petefreitag.com/item/728.cfm it might cost you more trying to protect in time coding and maintenance. Regards, Andrew Scott http://www.andyscott.id.au/ -Original Message- From: Rob Voyle [mailto:robvo...@voyle.com] Sent: Wednesday, 26 January 2011 11:53 AM To: cf-talk Subject: Re: Session variables security Hi Folks I have several large forms connected to mySql tables. I use cfqueryparam when querying and inserting data from the form after it has been validated for content that I need (no blank fields etc.) I created the following validation to check for scripts etc being injected. Is there anything else I should check for that would indicate someone was hacking the page. Thanks Rob ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341241 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Session variables security
Hi, When the user logs in, I save their username to the session scope. Would i need to re-validate that username at the top of every page that uses it in a database query? I previously thought this was not necessary but if it is possible for someone to send malicious sql injection then surely it is also possible (even though very unlikely) for someone to send code that changes the username stored in the session to some malicious sql injection. thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341131 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables security
On 1/24/2011 8:57 AM, Richard White wrote: Hi, When the user logs in, I save their username to the session scope. Would i need to re-validate that username at the top of every page that uses it in a database query? I previously thought this was not necessary but if it is possible for someone to send malicious sql injection then surely it is also possible (even though very unlikely) for someone to send code that changes the username stored in the session to some malicious sql injection. thanks Only if there is a place in your code for them to do so. If you have a vulnerable piece of code that can give unexpected and undesired results because of malicious inputs form the client, then you have a problem. But it is not an insecurity in the session variables is is an insecurity in your application and how it is setting those variables. There is no way for a user to send random code at a CF server and have it do anything to session variables unless it is happening somewhere in the CFML codebase. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341133 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Session variables security
OK thanks Ian On 1/24/2011 8:57 AM, Richard White wrote: Only if there is a place in your code for them to do so. If you have a vulnerable piece of code that can give unexpected and undesired results because of malicious inputs form the client, then you have a problem. But it is not an insecurity in the session variables is is an insecurity in your application and how it is setting those variables. There is no way for a user to send random code at a CF server and have it do anything to session variables unless it is happening somewhere in the CFML codebase. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341134 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Issues with session variables
We have an issue with early timeout using session and client variables. We are using ColdFusion 5. We have set up sessiontimeout for 2 hours in CFAPPLICATION as well as in CF Admin (maximum timeout and default timeout). But Session variables expire in approximately 45 sec. The same behavior is with client variables. Do you have any idea what it can be? Any help is appreciated. Thanks. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340762 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Issues with session variables
Are the session id and token cookies being set properly and retained by the browser and passed back to the application on subsequent requests? That is how ColdFusion links the request to the particular session in memory. If those values are being lost then CF wouldn't know what session to load. Without the cookies, the session values can be passed over the URL as well. -Justin On Thu, Jan 13, 2011 at 1:26 PM, Maneesha Aggarwal ma...@columbia.edu wrote: We have an issue with early timeout using session and client variables. We are using ColdFusion 5. We have set up sessiontimeout for 2 hours in CFAPPLICATION as well as in CF Admin (maximum timeout and default timeout). But Session variables expire in approximately 45 sec. The same behavior is with client variables. Do you have any idea what it can be? Any help is appreciated. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340765 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Issues with session variables
Exactly what he said. However, since you are also having trouble with client variables, I suspect that the memory storage location is the issue. Usually by default sessions are managed via the cookies on CF5. However it was possible to change this to Registry or choose a database. If the server is set to use the Registry it could be running out of storage space to save the sessions and thus they are getting lost (expired really). Look in the CF Admin for memory storage location and make sure it's set to cookies or a database provided that one was setup to do client variable storage. Wil Genovese Sr. Web Application Developer/ Systems Administrator Wil Genovese Consulting wilg...@trunkful.com www.trunkful.com On Jan 13, 2011, at 12:43 PM, Justin Scott wrote: Are the session id and token cookies being set properly and retained by the browser and passed back to the application on subsequent requests? That is how ColdFusion links the request to the particular session in memory. If those values are being lost then CF wouldn't know what session to load. Without the cookies, the session values can be passed over the URL as well. -Justin On Thu, Jan 13, 2011 at 1:26 PM, Maneesha Aggarwal ma...@columbia.edu wrote: We have an issue with early timeout using session and client variables. We are using ColdFusion 5. We have set up sessiontimeout for 2 hours in CFAPPLICATION as well as in CF Admin (maximum timeout and default timeout). But Session variables expire in approximately 45 sec. The same behavior is with client variables. Do you have any idea what it can be? Any help is appreciated. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340766 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Issues with session variables
For the timeout issue, there are a couple things, but most likely, your CF5 server is crashing. This is especially true if you have a busy server or use session application variables a good amount without using cflock. I think (and it's been a LONG time) you can check to see if your server is actually restarting itself by finding your windows event log. This is very possibly the case especially if you are experiencing this on your production server but not your development server (assuming you have one and they are separate machines). The solution? Upgrade your server to CF9 or if it's a money thing, go to Railo, it's perfectly fine and will do the job as well as give you a million new features that you can start to use. CF5 is well over a decade old. Stop running it. Stop punishing yourself. You are worth more than this. Oh I just noticed you said it works with client variables, too. Check the client timeout, check your cookie timeout, especially with Firebug to make sure they aren't set to expire within a minute. Then look for anything that interacts with cookies, cfide cftoken. You can pass #session.urltoken# in all your links to eliminate any possibilities of having a cookie issue. nathan strutz [http://www.dopefly.com/] [http://hi.im/nathanstrutz] On Thu, Jan 13, 2011 at 11:26 AM, Maneesha Aggarwal ma...@columbia.eduwrote: We have an issue with early timeout using session and client variables. We are using ColdFusion 5. We have set up sessiontimeout for 2 hours in CFAPPLICATION as well as in CF Admin (maximum timeout and default timeout). But Session variables expire in approximately 45 sec. The same behavior is with client variables. Do you have any idea what it can be? Any help is appreciated. Thanks. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340767 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
SESSION variables and cflock
From time to time I go back and read my CF books to see if I can glean something new. I was reading the section again on locking and I'm (rather belatedly) confused. The book says you should act on SESSION variables within a cflock because of potential collisions. But are my SESSION variables not mine and inaccessible to anyone else? How could there be a collision? Larry Stephens ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335971 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: SESSION variables and cflock
The book says you should act on SESSION variables within a cflock because of potential collisions. But are my SESSION variables not mine and inaccessible to anyone else? How could there be a collision? The same browser can make multiple concurrent requests; they will all be in the same session. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335980 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: SESSION variables and cflock
Think iframes or Ajax calls or other types of situations where A User may be session-linked to more than one current thread / process. In those cases, if there is potential for simultaneous writes to a session var, then you could theoretically have a clash. If your app uses no Ajax and has no other embedded code blocks that might trigger concurrency within a session, then locking would not be needed, in theory. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335984 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm