"The process cannot access the file because it is being used by another process". RRS feed

  • Question

  • I'm here sharing my experiences so that others that experience the same problem can find a solution faster.


    Ok, i've been having problems lately with syncronizing my files to my WHS (Windows Home Server) after i installed Power Pack 1


    I use Synctoy to do this and see no problem with that since the data corruption bug has now been resolved.

    First, my setup:

    1x Computer Running Windows Vista Ultimate 64Bit.


    1x Computer Running Windows Home Server with Power Pack 1 installed, no addons except 'Avast Antivirus', 'Disk Management' and the 'Lights out' addon.


    My WHS server is custom buildt running 4x500GB SATA disks where all folders have file duplication enabled. In addition, 2x150GB disks are used for the C and D partition, one disk has the OS installed and the other disk uses Software RAID to mirror the other disk (i had to resort to software raid because the OS install didn't accept drivers without a floppydrive, but that's another story). The 4 disk are thereby used entirely for files.

    After installing Power Pack 1 i noticed that i was having som problems with synchronizing files, basically i could read and copy FROM the WHS with no problem, but when copying files back TO the WHS server then it would sometimes fail, and not always on the exact same file(s) either. It would also not allow you to delete files on the WHS server.


    After rebooting just the WHS server the file-locking issued went away so it was clear that my Vista Machine was not the one holding the lock.


    First i thought it might be some random file-locking problem, that the Avast Antivrus or Indexing service or perhaps the Vista client OS that locked a files but after a while it became apparent that this could not be the case. Antivirus had been installed for many months and this issue had not surfaced earlier (no program updates for AV has been released either to my knowledge). The same went for the search/indexing service; it was included in the base install. I also uninstalled Windows Search 4.0 that i had installed recently, and the problem still presisted.


    I then suspected that file-sharing rights might be the problem, i therefore deleted all files and subfolders from my WHS shared folder and copied them back again from my Vista machine, all clean and new files again. After this it again failed showing the same problem; files were locked and not released.


    I then suspected some sort of 'corruption' due to the Folder duplication feature, thinking that perhaps the file tombstones was somehow messed up due to some changed introduced by the Power Pack or perhaps an errors introduced into my system before the Power Pack was installed that just recently surfaced. I disabled and re-enabled folder duplication waited several hours for it to re-duplicate everything, and again the same problem surfaced; files became locked and you could not overwrite/delete files.


    When using synctoy i basically i could do a 'Preview', where synctoy could detect all the files that were different between my vista machine those on the WHS. It would copy over any new files when i choose to 'Run' but any existing files that were to be overwritten, would fail with the message.

    "The process cannot access the file because it is being used by another process".

    Finally i stumbled across an article referring to opportunistic file locking.

    "Configuring opportunistic locking in Windows": http://support.microsoft.com/kb/296264/en-us


    Source: http://justanothersysadmin.wordpress.com/2008/03/30/vista-offline-files-and-smb-opportunistic-locks/


    After disabling the opportunistic file locking on my server i rebooted, and now everything works *sigh*.



    So here's a simplified list:

    • Running Windows Home Server
    • Installed Power Pack 1
    • Used Windows Vista Ultimate to syncronice files though network shared folders
    • Afterwards, Synctoy and just using windows Explorer to overwrite several files at once would cause WHS to lock files and not release the lock until WHS was rebooted.
    • After making several other approaches i discovered that it was caused by 'opportunistic file locking'
    • Now i can again syncronize files.

    As far as i know, opportunistic file locking is only useful if you use the 'offline files' feature in vista (in fact; offline files can't work without it), furthermore it is used to lock files on a server when you can have multiple clients connecting, i have only one. I suspect that the problem is that vista will detect that WHS provides this feature, and will then tell WHS to lock files that you are working on either through an application like synctoy or just windows explorer. Then due to some problem it fails to release those locks. I havent read enough about the subject to determine if the locks are permanent until released or timer-based but if the latter, then the timeout value is too long. It appears only to happend if you are working on multiple files at one time. Perhaps it's the sheer number of files accessed in a short time that triggers the problem.



    Can anyone else confirm that they have had this isse?


    Does anyone else have remarks regaring disabling opportunistic file locking, is there any danger in doing so?

    Tuesday, July 29, 2008 7:35 AM