Hi all,

I have a strange issue with CFLock: I have a named, exclusive lock that is
set to not throw exception on timeout, but it seems to not be timing out. I
thought that if throwontimeout=no, it just proceeds from after the close
/cflock ?

I have a data generation app (converts data from a bunch of SQL tables into
one XML file) that runs for up to a few hours.  This is a periodic process,
so I don't need to handle simultaneous generation, and don't care if it
takes a few hours. I'm trying to make it an exclusive process using a named
lock, and simply check a variable for whether it proceeded, but this isn't
working.

I have a suffix variable defined in application.cfm, so that if it runs in
this working folder it should have one lock name, in another folder should
have another lock name, so they can run at the same time.

I tried this exclusive, 10-second timeout, non-exception throwing lock, and
thought that the 2nd request (like refreshing the page) would see the
exclusive lock existing, timeout, and proceed to the error message. However,
that other request is just hanging. Other simple CF requests run fine, so
it's not an issue of the whole CF process hanging.

Here's my code, simplified:

<cfset GENERATEXMLCONFIG_hasrun = False>
<cflock
    name="GENERATEXMLCONFIG_#Request.LockSuffix#"
    type="exclusive"
    timeout="5"
    throwontimeout="false"
>
    <cfset GENERATEXMLCONFIG_hasrun = True>

    <H1>Generating XML parts...</H1>

    blablablabla<br>
    Lots of processing...<br>

    <!--- Sample code that takes a while --->
    <cfloop from="1" to="900000" index="idx">
        <cfoutput>#idx#</cfoutput>
    </cfloop>

    <cfoutput>   <p>#idx#</p>   </cfoutput>

</cflock>

<cfif   NOT   GENERATEXMLCONFIG_hasrun >
    <H1>Cannot generate. Another request is generating the XML.</H1>
</cfif>

Second request just waits however long the 1st one takes

Any ideas? should this work?

(server is CF 7.0.1 with cumulative hotfix 2)

thanks,
- David


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238561
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to