Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Recently a number of users on a win2003 server are being told that files are locked for editing when they try to open them. Usually they are told they have it open. Usually there is no evidence of that in the File Server Management under Open Files.

It is NOT a case of this being marked for editing on the client side, that I can tell. I have checked for this dozens of times. Indexing is not on, on this server. No backup processes are running. In short I have no idea of the cause.

I know that a restart will usually resolve this, but that is just not possible in a work environment when it occurs. So I feel compelled to wonder if killing whatever is causing the lock is possible... A search online turns up lots of apps that will unlock files. This does not really solve the cause, but I have to get work done in the mean time too.

How safe are they generally? Would you do this? Or what would you do?

additionally I should note that I used handle from sysinternals to close a locked file, and see no obvious problem, but still wonder. I believe it is the way excel files are closed which is causing this issue

share|improve this question
3  
Have you looked with Process Explorer to see what's really holding the files open? Maybe a dodgy on-access antivirus scanner? –  Ben Pilbrow Jul 28 '11 at 17:49
    
It may be another question, but when I see all of the open processes, how do I determine the specific file with the problem? You may be right concerning the AV. Do you know if the Av would lock as the accessing user? –  datatoo Jul 28 '11 at 18:00

3 Answers 3

up vote 2 down vote accepted

As others have said, I wouldn't trust unlocking programs to close file locks properly and I prefer to actually find out what is locking the file and either gracefully close it, or kill its process once I am aware of the ramifications of that.

It could be something like an on-access antivirus scanner on the client machine (which would maybe explain why they had it locked), but without actually seeing what has a handle on the file you will never know.

Fire up Process Explorer on the server and go to Find => Find Handle or DLL... Enter the name of a locked file into the dialog box and you will be told which processes have a handle on the process. In this example, you can clearly see it's Excel, but I've had this on my personal machine before where I couldn't move a file and it turned out to be my backup application which copies files to the cloud almost as soon as they are created.

enter image description here

Once you know what's locking the file, you can either choose to close it gracefully if possible, terminate it's process or even run Process Monitor to try and figure out why it's locking the file (that might be a pointless exercise, but might give you additional clues).

share|improve this answer
    
thanks for the explanation in figuring out what is locking a file +1 –  datatoo Aug 1 '11 at 17:02

In the general case, without specific knowledge of why there is a lock being held, HIDEOUSLY unsafe.

As a user you must assume that when files are locked there's a good reason -- some program has claimed that it is doing things to that file that cannot be interrupted by any other program or the seas will turn to blood, fire and brimstone will rain from the skies, and your dog will elope to Canada with the neighbor's fish.
If you revoke the lock with some kind of hackery (or a program that induces said hackery) you may incur the afore-mentioned biblical punishments, as well as the Righteous Wrath of the user whose file gets corrupted.

Better to find out the why behind the lock, and address the problem at its source.

share|improve this answer
    
I agree, but it is telling me I the user have the file open, when I do not see any evidence that I do. I never did trust the neighbor's fish either. –  datatoo Jul 28 '11 at 18:47
    
Without advocating the use of its unlock capability, I believe emcosoftware.com/unlock-it can show you which programs/processes hold open locks on a file. It will also let you unlock the file if you're really sure that's what you want to do and are willing to risk fire & brimstone :) –  voretaq7 Jul 28 '11 at 18:50

Unless the person using such a tool has the experience and knowledge to make an intelligent and informed decision about whether it should even be used in any given situation they should be prevented from doing so.

I routinely us unlocker but never without looking to see what is holding the file locked and ensuring there are no more "polite" ways to achieve the same end. Because of the very real potential for damage I won't allow the users access to the same tool.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.