CF / IIS Service LockUp when using CFMX7, MS Access, and File Uploads

A client regularly uploads an Access database (I know, I know, not the best one for the job.. but the point is another blog/argument) which is then a CFMX7 datasource.

Occasionally and intermittently over the last few years, the .mdb file would be locked, showing the corresponding .ldb file and the uploads would fail. But these files weren't just locked. They were so tightly bound, that FTP deletes would not delete. Even the hosting support personnel could not delete. They had to shut down the CF server, and IIS to delete the files and then restart. Not good news for other accounts the shared hosting server.

Even more interesting is that all of a sudden, the problem became more frequent (locking 6 times yesterday, and 5 more today)... and thus, replicable. It appears as if CF Access datasource connection creates the lock (appropriately) when a query of any sort is performed, even SELECT statements. Attempting an upload while the file is "locked" however doesn't just reject the upload, it corrupts the files and the service.

We don't know what changed, but every single upload now locks. and I suspect the java method that creates the datasource link may lock the database at the application.cfc level. (Any CF/JAVA wizards, please feel free to chime in on this suspician if you know one way or the other). IIS is v6.

To correct this, have the CF Administrator UNcheck that the "maintain database connections" . Creating a "dummy" query is only for pre CF6.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
John Farrar's Gravatar I have one suggestion... dump Access for web servers. :) ... Hate to admit that is where I started with CF. Using it for prototyping is not awful in my book but you should retire the live server stuff and migrate ASAP IMO. This is just a suggestion... but NEVER accept a project with Access as a deployed solution again. Won't look down on anyone who has but you should expect issues.

With that said are you using <cflock /> in the code? or <cftransaction /> (not saying either of them is the answer but they are things that come to my mind in light of the issues. Also... do you have the current update of ColdFusion on that server? If not you could be running with a bug that may already have been eliminated. Lastly... when are you opening the query? You should not be doing logic processing to databases (design suggestion here) inside the Application.cfc file. (I doubt you are but wanted to make sure based on the description you were not.)
# Posted By John Farrar | 3/31/09 9:42 PM
Azadi Saryev's Gravatar creating a 'dummy' query has always worked for me on CFMX7... though i can't recall now if 'maintain db connections' was checked for that dsn or not... and the locks were not related to uploading a new .mdb file in my case, but to losing internet connection to the server (connectivity is sometimes just plain awful here in Laos...) - these locks were easily cleared using a 'dummy' query against the dsn.

as for uploading updated db to the server, the way it used to be done on this site was the new db was uploaded to same dir as live one, but with a different filename. then late at night the live and old file was deleted and new one renamed to proper name... oh what a pain it was! i am SO happy NOT to have to deal with access as server db any more :)

Azadi
# Posted By Azadi Saryev | 3/31/09 10:53 PM
Tami's Gravatar @Azadi... Yep, I agree... dump Access, but some clients are slower to embrace appropriate technologies than others. In this case... we got them to migrate from Coldfusion datasourcing to an Excel spreadsheet to an Access one.... MySQL is the next logical step, but the client just isn't ready.

Why not? Moslty financial reasons. First, this is a non-profit organization and second, in the home building industry, so they have a double whammy to contend with on the economic front. The best solution is to get them online in a crisis, then when everyone has time to breathe, re approach them about planning on having a sustainable, reliable Internet capable database.

Also @John... We only had this access locking issue occuring a few times per year. We do not know what happened in the last month that made it a consistent replicatible problem. No cflocks, no logins... just queries. It even looks like the lock is getting set for any .cfm page (perhaps at the application.cfc level when the datasource is defined -- no db calls or processing there) regardless of whether or not that page has any queries on it.

Thanks for telling your experience. It is always helpful to realize I am not nuts and that others have bumped into similar issues :)
# Posted By Tami | 4/1/09 7:06 PM
Larry C. Lyons's Gravatar Its been a long while since I've had to do handle such a situation, (not since CF5 I think), but there is a work around. Create a blank Access database then go into that and link to the uploaded access file. You make the datasource connection the blank access db and because of the linking as far as CF is concerned the tables from the linked (i.e., uploaded db) are available. What's more is that you can easily replace the uploaded db without any lockiing issues.

hth,
larry
# Posted By Larry C. Lyons | 4/2/09 12:09 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact HHWD