<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Memory Leaks: Part III &#8211; sessions and cfcs</title>
	<atom:link href="http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=memory-leaks-part-iii-sessions-and-cfcs</link>
	<description>Mike Schierberl&#039;s thoughts on software development</description>
	<lastBuildDate>Wed, 06 Jun 2012 00:33:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Charlie Arehart</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-78</link>
		<dc:creator>Charlie Arehart</dc:creator>
		<pubDate>Sun, 24 Aug 2008 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-78</guid>
		<description>So Mike (and other readers commenting on this entry), did things ever get resolved with the memory leaks you were observing?  Some of the comments point to what was ultimately found to be caused by file uploads, fixed in an available hotfix in 7.02 (must be applied manually, not implemented by Cumulative Hot Fixes). Some identify that bad programming practices can cause what seem to be leaks.

But Mike you&#039;ve contended all along that this was not the case for you. If perhaps you ended up writing another entry about all this, can you point to it here, so readers can find it? Or if you never solved it, but perhaps it went away when you moved to CF8 (or something else changed), please do tell. :-) I&#039;m sure many readers (for years) will look forward to the understanding shared here.</description>
		<content:encoded><![CDATA[<p>So Mike (and other readers commenting on this entry), did things ever get resolved with the memory leaks you were observing?  Some of the comments point to what was ultimately found to be caused by file uploads, fixed in an available hotfix in 7.02 (must be applied manually, not implemented by Cumulative Hot Fixes). Some identify that bad programming practices can cause what seem to be leaks.</p>
<p>But Mike you&#8217;ve contended all along that this was not the case for you. If perhaps you ended up writing another entry about all this, can you point to it here, so readers can find it? Or if you never solved it, but perhaps it went away when you moved to CF8 (or something else changed), please do tell. :-) I&#8217;m sure many readers (for years) will look forward to the understanding shared here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JT</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-69</link>
		<dc:creator>JT</dc:creator>
		<pubDate>Tue, 07 Aug 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-69</guid>
		<description>Testing methods.

In your examples you use Application scope for your CFC. a CFC in application scope will always be maintained so by adding 100 instances of itself to an ongoing array will always increase. Unless I am missing something it seems to me that it works exactly as you coded.   100 instances are created per request and stored in the array in the cfc. this adds exactly as you show it in the #instances.</description>
		<content:encoded><![CDATA[<p>Testing methods.</p>
<p>In your examples you use Application scope for your CFC. a CFC in application scope will always be maintained so by adding 100 instances of itself to an ongoing array will always increase. Unless I am missing something it seems to me that it works exactly as you coded.   100 instances are created per request and stored in the array in the cfc. this adds exactly as you show it in the #instances.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Schierberl</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-70</link>
		<dc:creator>Mike Schierberl</dc:creator>
		<pubDate>Tue, 07 Aug 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-70</guid>
		<description>JT-

Keep in mind that the 100 instances of the cfc are created within the VAR scope of the method that is being called.  These variables are scoped locally to the cffunction, and not part of the component&#039;s scope.  Any variables within the var scope should only live for the lifetime of the method call.</description>
		<content:encoded><![CDATA[<p>JT-</p>
<p>Keep in mind that the 100 instances of the cfc are created within the VAR scope of the method that is being called.  These variables are scoped locally to the cffunction, and not part of the component&#8217;s scope.  Any variables within the var scope should only live for the lifetime of the method call.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sana</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-74</link>
		<dc:creator>Sana</dc:creator>
		<pubDate>Sun, 20 May 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-74</guid>
		<description>I tried your testing code from part 1 to 3. I am 200% sure there is memory leakage.

The solution I found is to store all complex objects in server scope rather in Application scope or sesssion scope.

@Hemant did you test mentioned scenarios. 

my suggestion is to store all complex object in server scope and you will see there is no memory leakage problem.

I am happy to help anybody who is struggling like these issues.

Thanks
Sana</description>
		<content:encoded><![CDATA[<p>I tried your testing code from part 1 to 3. I am 200% sure there is memory leakage.</p>
<p>The solution I found is to store all complex objects in server scope rather in Application scope or sesssion scope.</p>
<p>@Hemant did you test mentioned scenarios. </p>
<p>my suggestion is to store all complex object in server scope and you will see there is no memory leakage problem.</p>
<p>I am happy to help anybody who is struggling like these issues.</p>
<p>Thanks<br />
Sana</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hemant</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-64</link>
		<dc:creator>Hemant</dc:creator>
		<pubDate>Mon, 23 Apr 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-64</guid>
		<description>There is a hotfix now available for this issue. Please see 

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=kb401239

This should fix the problem. 

Thanks,
Hemant</description>
		<content:encoded><![CDATA[<p>There is a hotfix now available for this issue. Please see </p>
<p><a href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=kb401239" rel="nofollow">http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=kb401239</a></p>
<p>This should fix the problem. </p>
<p>Thanks,<br />
Hemant</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Sheedy</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-76</link>
		<dc:creator>Jason Sheedy</dc:creator>
		<pubDate>Thu, 12 Apr 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-76</guid>
		<description>Hi Mark,
I have experience this memory leak and have also replicated your tests. I&#039;ve written up a long post on it here.

http://www.jmpj.net/jason/index.cfm/2007/4/14/Cold-Fusion-Memory-Leak</description>
		<content:encoded><![CDATA[<p>Hi Mark,<br />
I have experience this memory leak and have also replicated your tests. I&#8217;ve written up a long post on it here.</p>
<p><a href="http://www.jmpj.net/jason/index.cfm/2007/4/14/Cold-Fusion-Memory-Leak" rel="nofollow">http://www.jmpj.net/jason/index.cfm/2007/4/14/Cold-Fusion-Memory-Leak</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Bouley</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-73</link>
		<dc:creator>Jeff Bouley</dc:creator>
		<pubDate>Wed, 28 Mar 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-73</guid>
		<description>Tom, 

Persisting large objects, i.e. queries nested in a structure does not necessarily cause a memory leak.  It just takes up large amounts of memory for each active user of your system.  I limit the use of session for this very reason.  I once witnessed an application that cached much of the database in session (YIKES, poor design).  With every new session I would see 4 meg peel off the server.  Not a memory leak just poor design.  Hope this helps.</description>
		<content:encoded><![CDATA[<p>Tom, </p>
<p>Persisting large objects, i.e. queries nested in a structure does not necessarily cause a memory leak.  It just takes up large amounts of memory for each active user of your system.  I limit the use of session for this very reason.  I once witnessed an application that cached much of the database in session (YIKES, poor design).  With every new session I would see 4 meg peel off the server.  Not a memory leak just poor design.  Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Peer</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-68</link>
		<dc:creator>Tom Peer</dc:creator>
		<pubDate>Wed, 07 Mar 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-68</guid>
		<description>Mike,

We think actually we might just have found the leak.

Thanks to your tips we got JRockit running and ran a test against our app. There were thousands of instances of coldfusion.sql.* classes.

I immediately thought that the query of queries we use may be the issue so we wrote a little app that did the following:

1/ Create a component in the application scope with some methods to do query of queries on a structure of queries passed into it.

2/ Create an Structure with several keys, all different queries, and persist it in the session scope.

3/ Pass the structure as an argument to the methods of the component.

4/ Load test the app.

CF leaks like a rusty bucket.

Rewriting our app as we speak. Many thanks for all your tips.

Tom</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>We think actually we might just have found the leak.</p>
<p>Thanks to your tips we got JRockit running and ran a test against our app. There were thousands of instances of coldfusion.sql.* classes.</p>
<p>I immediately thought that the query of queries we use may be the issue so we wrote a little app that did the following:</p>
<p>1/ Create a component in the application scope with some methods to do query of queries on a structure of queries passed into it.</p>
<p>2/ Create an Structure with several keys, all different queries, and persist it in the session scope.</p>
<p>3/ Pass the structure as an argument to the methods of the component.</p>
<p>4/ Load test the app.</p>
<p>CF leaks like a rusty bucket.</p>
<p>Rewriting our app as we speak. Many thanks for all your tips.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Peer</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-65</link>
		<dc:creator>Tom Peer</dc:creator>
		<pubDate>Tue, 06 Mar 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-65</guid>
		<description>Robi

I&#039;ve had quite a few responses to my page at

www.digitalmethod.co.uk/cf

all from people with the same problem.

I have 4 servers running ColdFusion, one of which has been running for months without a restart and one of which needs a restart every 12 hours.

The only difference is the amount of load they&#039;re under. Are you sure in your stress tests that you have simultaneous threads running, and that the server is at its limits?

I&#039;m almost certain that there&#039;s a memory leak in CF pertaining to components, and I think it happens when simultaneous requests call the same method of a component in the application scope using a session scope variable as an argument, something like:

application.objUser.fnCheckLogin(session.sUser)

where objUser would be a component and session.sUser is a Struct in the session scope.

A good test would be to create a function that uses all the suspected functions - CreateUUID(), hash(), arrayAppend(), StructCopy(), etc and call it with a session struct as an argument.

Having said that this issue does seem to be only affecting Windows users so the problem may be completely unrelated!

Tom</description>
		<content:encoded><![CDATA[<p>Robi</p>
<p>I&#8217;ve had quite a few responses to my page at</p>
<p><a href="http://www.digitalmethod.co.uk/cf" rel="nofollow">http://www.digitalmethod.co.uk/cf</a></p>
<p>all from people with the same problem.</p>
<p>I have 4 servers running ColdFusion, one of which has been running for months without a restart and one of which needs a restart every 12 hours.</p>
<p>The only difference is the amount of load they&#8217;re under. Are you sure in your stress tests that you have simultaneous threads running, and that the server is at its limits?</p>
<p>I&#8217;m almost certain that there&#8217;s a memory leak in CF pertaining to components, and I think it happens when simultaneous requests call the same method of a component in the application scope using a session scope variable as an argument, something like:</p>
<p>application.objUser.fnCheckLogin(session.sUser)</p>
<p>where objUser would be a component and session.sUser is a Struct in the session scope.</p>
<p>A good test would be to create a function that uses all the suspected functions &#8211; CreateUUID(), hash(), arrayAppend(), StructCopy(), etc and call it with a session struct as an argument.</p>
<p>Having said that this issue does seem to be only affecting Windows users so the problem may be completely unrelated!</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Schierberl</title>
		<link>http://www.schierberl.com/blog/memory-leaks-part-iii-sessions-and-cfcs/#comment-66</link>
		<dc:creator>Mike Schierberl</dc:creator>
		<pubDate>Tue, 06 Mar 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">#comment-66</guid>
		<description>Aaron-
   
I&#039;m still not quite sure why Robi was not able to recreate the issue in his local environment.  A few months ago I tried running with Robi&#039;s suggested jvm.config and jrun.xml and was still able to reproduce the behavior.  In fact, I have now been able to reproduce on almost every combination of the following environments.  (and verify that code changes fix the behavior)

CFMX:  6.1, 7.01, 7.02
JVM: Sun 1.4, Sun 1.5, BEA 1.4, BEA 1.5
OS: Windows Server 2003, Windows XP
(I have also tested a completely clean CFMX 7.02 install on WinServer 2003, with nothing else on the machine)

I know that Robi still doesn&#039;t think that there is an issue with code, and believes it is related to environment, but I see a flaw in the test logic.  When testing, in order to verify a fix I would follow these rules.

1. Reproduce the behavior
2. Make a Change to one variable in the equation (code, environment, etc)
3. Does behavior still exist? If yes, revert change and try another
4. Continue testing one variable at a time until behavior no longer exists

In Robi&#039;s case, he was NEVER able to complete step 1, which means his testing really doesn&#039;t tell us anything at all.  The problem could be related to environment OR code, but there is NO way to tell with his tests.

In my case, I was able to demonstrate the behavior, then ONLY make a change to code and verify that the behavior was fixed.  There is still a potential for an environment workaround, but I wasn&#039;t able to find one. Until someone can reproduce the problem, make a tweak to the environment, and verify that the problem no longer exists, I don&#039;t think that anyone can claim it is strictly an environment issue.

One additional note I would like to clarify is that we are talking about &quot;Variables&quot; scope here, NOT Var scope which Robi mentioned above.</description>
		<content:encoded><![CDATA[<p>Aaron-</p>
<p>I&#8217;m still not quite sure why Robi was not able to recreate the issue in his local environment.  A few months ago I tried running with Robi&#8217;s suggested jvm.config and jrun.xml and was still able to reproduce the behavior.  In fact, I have now been able to reproduce on almost every combination of the following environments.  (and verify that code changes fix the behavior)</p>
<p>CFMX:  6.1, 7.01, 7.02<br />
JVM: Sun 1.4, Sun 1.5, BEA 1.4, BEA 1.5<br />
OS: Windows Server 2003, Windows XP<br />
(I have also tested a completely clean CFMX 7.02 install on WinServer 2003, with nothing else on the machine)</p>
<p>I know that Robi still doesn&#8217;t think that there is an issue with code, and believes it is related to environment, but I see a flaw in the test logic.  When testing, in order to verify a fix I would follow these rules.</p>
<p>1. Reproduce the behavior<br />
2. Make a Change to one variable in the equation (code, environment, etc)<br />
3. Does behavior still exist? If yes, revert change and try another<br />
4. Continue testing one variable at a time until behavior no longer exists</p>
<p>In Robi&#8217;s case, he was NEVER able to complete step 1, which means his testing really doesn&#8217;t tell us anything at all.  The problem could be related to environment OR code, but there is NO way to tell with his tests.</p>
<p>In my case, I was able to demonstrate the behavior, then ONLY make a change to code and verify that the behavior was fixed.  There is still a potential for an environment workaround, but I wasn&#8217;t able to find one. Until someone can reproduce the problem, make a tweak to the environment, and verify that the problem no longer exists, I don&#8217;t think that anyone can claim it is strictly an environment issue.</p>
<p>One additional note I would like to clarify is that we are talking about &quot;Variables&quot; scope here, NOT Var scope which Robi mentioned above.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.schierberl.com @ 2013-05-19 18:27:03 -->