Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stuck in Locking

Status
Not open for further replies.

lrdurt

Programmer
Jan 19, 2001
3
US
Hello,

I am really having problems with locks. Somehow my application has reached what appears to be a deadlock situation. I do not have any nested CFLOCKs that I can find. The locking scope appears to be application, at least this is the kind of lock I am trying to establish when I get all of my errors. The only way I have found to resolve the problem is to restart the ColdFusion server.

Does anyone have any ideas?

Thanks in advance,

R. Allen Wilkinson aka lrdurt
 
What error message are you getting and can you reproduce the problem every time? Iow, does the same actions make it lock every time?

GJ
 
I can not reproduce the error. Once the error occurs, I can try to obtain an application lock and the result is this error.

Error Diagnostic Information

Timed out while waiting to obtain exclusive access

The error occurred while processing an element with a general identifier of (CFLOCK), occupying document position (54:1) to (54:41) in the template file
C:\INETPUB\
I have looked at this line of code and it looks fine. As a matter of fact it works until something in the system causes the lock to be generated and it does not go away.

Here is that line of code anyway:
<CFLOCK SCOPE=&quot;Application&quot; timeout=&quot;30&quot; type=&quot;Exclusive&quot;>

Thanks for the help,

Allen
 
that means some other page is using the variable you're trying to lock, or is just accessing any locked variable, as you didn't provide a way to identify them. Try to give your locks NAMES so that the app won't think they're all the same !!!
 
Hey Allen,

Sorry, I didn't realize you had responded. I had one quick thought, you're not by chance on a shared server are you? I'm wondering if your application name conflicts with someone else's application. You might try re-naming your application in the <cfapplication> tag and see if that helps. Someone else's problem might be affecting you.

If you're on your own, I would remove all of your <cflock> tags and add them back in until you find the first one which causes the problem. I would then take a look at the code in that block. I'm guessing that you have some type of loop that gets hung and then keeps anything else from executing with a <cflock>.

If you find the block that's causing it, I think you'll find your dead-lock problem. If not, just post the code in the block and we'll take a look.

GJ
 
Hello again,

I have found some more facts. I am using ColdFusion 4.5.1.

iza - I am locking the &quot;application&quot; variables using the 4.5 syntax. The use of &quot;NAME&quot; is optional.

Gunjack - I have checked and I am not having an application name conflict. Surprisingly we (all 3 of us) all are using distinct and meaningful names for our applications.

I have 5 cfm files that use locks.

The first lock is used to protect queries, no looping.
<cflock timeout=&quot;60&quot; throwontimeout=&quot;No&quot; name=&quot;COMPROOM_UPDATE&quot; type=&quot;EXCLUSIVE&quot;>

The second lock is to lock application variables for initialization, there is some looping in this lock.
<CFLOCK SCOPE=&quot;Application&quot; timeout=&quot;30&quot; type=&quot;Exclusive&quot;>

The third lock is to lock queries so only one person at a time can do a function.
<cflock timeout=&quot;#Attributes.Lock_Timeout#&quot; throwontimeout=&quot;Yes&quot; type=&quot;EXCLUSIVE&quot; scope=&quot;APPLICATION&quot;>

The fourth lock is so only one table or field can be updated at a time, there is some looping in this lock.
<CFLOCK timeout=&quot;15&quot; throwontimeout=&quot;No&quot; type=&quot;EXCLUSIVE&quot; scope=&quot;SERVER&quot;>

The fifth and final lock is to allow only one person at a time to get the next available ID so that everyone gets a unique value.
<cflock timeout=&quot;10&quot; throwontimeout=&quot;No&quot; type=&quot;EXCLUSIVE&quot; scope=&quot;SERVER&quot;>

Thanks for all the help so far.

Allen
 
It looks to me that the problem lies between one of these two sections below. When the locking occurs, do the pages with the other <cflocks> still execute? If so, please post the code in these two lock sections below. Also, what is the timeout for #attributes.loc_timeout# and can you verify it has the number your expecting. If this is somehow getting set too high, it might not timeout like you expect in the event of an error.

GJ

<CFLOCK SCOPE=&quot;Application&quot; timeout=&quot;30&quot; type=&quot;Exclusive&quot;>

<cflock timeout=&quot;#Attributes.Lock_Timeout#&quot; throwontimeout=&quot;Yes&quot;
type=&quot;EXCLUSIVE&quot; scope=&quot;APPLICATION&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top