Windows 2008 R2 - Kernel (System Process PID=4) is locking files and folders for a long time. For example when deleting a file, the file may remain locked for 1 minute or more and only after that be deleted. On another occasions I encountered files or folders I could not delete. ProcMon showed that the System Process was holding a handle to those resources for a couple of minutes and then released them None of the resources I mentioned were system resources, only files and folders installed be me and handled by my applications.
Open AdministrativeTools -> Share and Storage Management. From the Actions pane, click Manage Open Files. Here you are able to see all locked files and folders on this server. To clear a lock, select the relavent file and click “Close Selected”.
Microsoft/SysInternals Process Explorer - Go to Find > Find Handle or DLL. In the "Handle or DLL substring:" text box, type the path to the file (e.g. "C:\path\to\file. txt") and click "Search". All processes which have an open handle to that file should be listed.
A fundamental of file systems since their inception has been their locking mechanisms. These exist so that different users and applications working on the same file (or region of a file) simultaneously cannot cause conflicts that result in inaccuracies and inconsistencies in the data.
As Dani has already mentioned in the comment:
It's a bug in Windows 7 and likely in Windows Server 2008 (possibly 64bit versions only). It surfaces when you disable Application Experience service.
Re-enabling this service has fixed this problem for me.
A bit more info here as to why it's causing a problem.
List of other SO questions which seem to be related:
Files accessed through a share will be locked by the system process (PID 4).
Try opening compmgmt.msc
-> System Tools -> Shared Folders -> Open Files to see if the locked file is listed there
See also the sysinternals forum for a way to replicate this.
Not all applications lock files when they are opened, Excel however does...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With