A timeout occurred while attempting to lock wheelsReloadLock

486 views
Skip to first unread message

William Fisk

unread,
Oct 6, 2011, 4:09:03 AM10/6/11
to cfwh...@googlegroups.com
This has been discussed before here, your CFWheels application throws this error message "A timeout occurred while attempting to lock wheelsReloadLock" every time you try to sumbit a link with "?reload=true" and so you have no way of resetting the application without restarting the server.  It occurs because a CFLOCK with and name ="wheelsReloadLock" gets timed out.

I don't know why I didn't think of it before but you can also get round the problem by simply editing the Wheels code in your application and renaming every "wheelsReloadLock" so simething else, say, "wheelsReloadLock2", then you'll be able to reset your application.  I was wondering if you thought this was a good solution - we could maybe replace all the "wheelsReloadLock" with "#application.wheels.reloadLock#" and then have an optional query parameter "reloadLock" which could change (temporaily) this parameter, so that if "?reload=true" does not work I could put "?reload=true&reloadLock=wheelsReloadLock2"

What do you think?

William

tpet...@gmail.com

unread,
Oct 6, 2011, 10:24:46 AM10/6/11
to ColdFusion on Wheels
this issue has pissed me off for the last time. do me a favor and try
out this code, just paste above the $runOnRequestStart() replacing the
onRequestStart() method:

<cffunction name="onRequestStart" returntype="void" access="public"
output="false">
<cfargument name="targetPage" type="any" required="true">
<cfscript>
// abort if called from incorrect file
$abortInvalidRequest();

if($shouldReloadWheels())
{
$simpleLock(execute="$reloadingWheels", name="wheelsReloadLock",
type="exclusive", timeout=180);
}

// run the rest of the request start code
$simpleLock(execute="$runOnRequestStart", executeArgs=arguments,
name="wheelsReloadLock", type="readOnly", timeout=180);
</cfscript>
</cffunction>

<cffunction name="$shouldReloadWheels" returntype="boolean"
access="public" output="false">
<cfscript>
if(
!StructKeyExists(application, "wheels")
|| (
StructKeyExists(URL, "reload")
&& (!StructKeyExists(application, "wheels")
|| !StructKeyExists(application.wheels, "reloadPassword")
|| !Len(application.wheels.reloadPassword)
|| (StructKeyExists(URL, "password") && URL.password ==
application.wheels.reloadPassword))
)
)
{
return true;
}
return false;
</cfscript>
</cffunction>

<cffunction name="$reloadingWheels" returntype="void" access="public"
output="false">
<cfscript>
if (StructKeyExists(URL, "reload"))
{
// need to setup the wheels struct up here since it's used to store
debugging info below if this is a reload request
$initializeRequestScope();
$debugPoint("total,reload");
}
onApplicationStart();
</cfscript>
</cffunction>



On Oct 6, 4:09 am, William Fisk <william.f...@gmail.com> wrote:
> This has been discussed before here<http://A%20timeout%20occurred%20while%20attempting%20to%20lock%20whee...>,

Per Djurner

unread,
Oct 6, 2011, 11:12:22 AM10/6/11
to cfwh...@googlegroups.com
Just to be clear, this is not Wheels "fault".
If you have a request running at the time of trying to reload the app
and that request takes more than 30 seconds, the reload request will
time out (it's waiting, trying to put an exclusive lock on the app).

Maybe some server monitoring can shed some light on what request is
blocking the reload?

Question for you, when you reload and it fails like that does it cause
any other errors on the site or only the "timeout" one?
I'm asking because I used to have problems with a reload failing
half-way and causing tons of errors on the site for other users.

/ Per

> --
> You received this message because you are subscribed to the Google Groups
> "ColdFusion on Wheels" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cfwheels/-/MXQRCEVuuu0J.
> To post to this group, send email to cfwh...@googlegroups.com.
> To unsubscribe from this group, send email to
> cfwheels+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cfwheels?hl=en.
>

William Fisk

unread,
Oct 6, 2011, 1:07:27 PM10/6/11
to cfwh...@googlegroups.com
And just to be clear, I've never had this problem in production (although my sites do not get heavy usage).  I just got this problem the other day on a development server but I still wanted to avoid restarting the ColdFusion server (mainly because I don't have access), and that's what made me think of this idea of renaming the CFLOCK which for me did the trick.

I think I created the problem by doing a reload=true too many times with a request that was taking a long time - not something an end-user would do either.

Tony - I added your code but I think I've got the site in a deadlock situation and your code does not me get out of it.  One thing I don't know to do is create a deadlock situation.  I'll do a bit of testing to see if I can force a deadlock to happen - unless anywone hass got a good idea of how to do that.

William

tpet...@gmail.com

unread,
Oct 6, 2011, 1:29:54 PM10/6/11
to ColdFusion on Wheels
we've had the deadlock problem in dev mode for a awhile now. you can
replicate it very easily be just mashing the refresh key. it still
pisses me off that this happens.

another thing that i can think of is that when reloading, we set an
application variable and any requests that come in that aren't reload
requests get thrown to the maintenance page. once the reload code
happens it will reset the application scope, clearing the variable
while still having an exclusive lock on the application. once it's
done reloading then thing can resume to normal. i'll mock up some code
later to further explain this.

William Fisk

unread,
Oct 7, 2011, 4:09:38 AM10/7/11
to cfwh...@googlegroups.com
Mmm, I am not sure I am able to replicate it so easily.

I'll incorprate the code you gave above into my current Wheels project to see if there are any issues.

tpet...@gmail.com

unread,
Oct 7, 2011, 8:29:12 AM10/7/11
to ColdFusion on Wheels
cool. please keep me in the loop about any issues.
Reply all
Reply to author
Forward
0 new messages