How to make ColdFusion 7 unresponsive in just a sec
By Ruben on Jul 1, 2006 | In ColdFusion | 1 feedback »
First of all the reason I publish this article is because for a few years I'm dealing with ColdFusion becoming unresponsive after running for a while.
And because I host several companies on a shared hosting environment I had no clue what code caused problems that led to unresponsiveness of ColdFusion 6 and 7.
This problem is still present in the latest updater released last week (version: 7.0.2, date: 06/28/2006) by Adobe.
OK, the following CFM code to hang ColdFusion has been tested on:
- Linux (Red Hat)
- ColdFusion 7 Standard Edition (version: 7.0.1 or 7.0.2)
Probably ColdFusion 6.x will hang too.
(help me make this list complete. e.g. enterprise edition? windows?)
<cfset myForever()>
<cfscript>
function myForever() {
while(1 EQ 1) {
calc = (8 * 7.3)/11.78;
}
}
</cfscript>
Simply request this page in your browser a few times until you reach the "maximum number of simultaneous requests". (CF Admin > Server Settings > Settings)
I will explain what happens.....
ColdFusion can handle a certain amount of requests simultaniously. To avoid unlimited loops and deadlocks in ColdFusion has a timeout mechanism. After a certain amount of seconds ColdFusion aborts running page-requests that are over due.
My experiment demonstrates that ColdFusion never aborts unlimited loops from User Defined Functions. But that's only true for UDF's made in cfscript.
If you transform the cfscripting to Cffunction-code it does timeout.
A note for Adobe:
I just found out today the way to reproduce this bug. That's the reason I couldn't report it to you for the 7.0.2 release!
1 comment
I checked this code on Railo and at first I thought it would crash my Railo server too. But since the server had a lot to do and the request-stopping thread runs with lower priority it took Railo a while to abort the requests. I started about 30 requests and after 90 seconds (my requesttimeout is at 30 seconds) Railo aborded all requests.
Cheers Gert
Comments are closed for this post.
« Installing Tomcat 5.5 with OpenLaszlo + Red5 | Red5 start/stop init script on CentOS / RedHat Linux » |