Sun, 15 Jan 2006
There is something screwy in Coldfusion's locking. If you make a cfm page that contains the code below. What you would expect is that executing the code would never take more than a shade over 15 seconds, as it can wait up to one second to aquire the lock, and then spend 14 seconds sleeping.
It appears that in some cases, this is what happens. For example, if you get the page from two wget sessions. It also will show you the error message if you go to the URL, then (whilst waiting) hit refresh. Unfortunately if you go to the URL in two different windows in Firefox, it appears that the second window will wait the whole time for the lock to be released (so up to 28 seconds total). I can't see why this would happen. Could it be something session related?
<cftry> <cflock name="testLock" timeout="1" throwOnTimeout="yes"> Got lock, sleeping...<cfflush> <cfset thread = CreateObject("java", "java.lang.Thread")> <cfset thread.sleep(14000)> finished. </cflock> <cfcatch type="Lock"> Another process already has the lock. </cfcatch> </cftry>
Last updated: 16:51, 15 Jan 2006 Link..