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]

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.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

Reply via email to