Jon, Perhaps I'm missing something and this is an entirely new and clever approach. I've never tried to use CFLOCK as a timeing mechanism. But what you are doing here with your named locks seems like intentionally hanging the process - something I usually tried to avoid doing by accident <g>. Do many developers use this approach? Are you sure this is the best way to go about creating execution time in your process?
-mk -----Original Message----- From: jon hall [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 1:58 PM To: CF-Talk Subject: Strange threading issue, cflock? Another locking question...might be a bug in CF5. Using CF5, I have a database insert that I need to pause a few seconds, then select a value back out that is updated from withing the db. My code looks something like this: <cfquery .../> // Insert Query <cfset name = Hash(CreateUUID())/> <cflock name="#name#" type="readonly" timeout="1"> <cflock name="#name#" type="exclusive" timeout="5" throwontimeout="No"></cflock> </cflock> <cfquery .../> // Select Query What is strange is that the second query is not executing after the cflock times out. It seems that it must be executing _before_ the cflock starts! The database usually takes about 1 second to update the field, and even if I set the timeout to 20 seconds the recordset returned always contains data that would indicate that the query didn't wait until the cflock timed out, but executed before the cflock... It gets stranger even. If I set the timeout high enough and try to execute a second page with only the bottom query from above at the same time I am executing the above cfquery/cflock/cfquery block the single cfquery on a totally different page waits for the lock to execute, even though it has no cflocks anywhere in it! The rest of the site continues to operate normally, with CF executing pages, but it's like this particular cfquery block is respecting the cflock in the other page, even though it's not in a cflock itself. To even futher the proof, I have two databases, a primary and a backup that I can perform the same two queries against. The second page with the query by itself queried using the other DSN, executes instantly! Only when I use the same DSN does this page stop everything it is doing to wait for the second one to execute. All of this seems to contradict what I know about how CF uses locks. I think it's a bug with cflock...and a nasty one. Anyone know what may be going on? -- jon mailto:[EMAIL PROTECTED] ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

