When running on Windows Server 2008 R2, sometimes our service encounters the following problem accessing a file:
.... Win32 Error: CreateFile of document file <\\server\folder1\folder2\file.ext> failed. GetLastError returned: <32>, <The process cannot access the file because it is being used by another process….>
The shared file resides on a dedicated Windows 2008 R2 file server, our service runs on a different application server, also under Windows 2008 R2 server.
Sysinternal’s Process Monitor on the file server shows this:
Date & Time 22.03.2018 16:39
Time of Day 16:39:15
Process Name System
PID 4
TID 1364
User NT AUTHORITY\SYSTEM
Parent PID 0
Operation IRP_MJ_CREATE
Path H:\folder1\folder2\file.ext
Result SHARING VIOLATION
Detail Desired Access: Generic Read, Dis, Options: Non-Directory File, Complete If Oplocked, Attributes: N, ShareMode: None, AllocationSize: n/a, Impersonating: S-1-5-21-2753595274-792687809-3808857278-4148
Running ProcMon on the application server (on a different day):
Date & Time 12.03.2018 10:48
Time of Day 10:48:21
Process Name ourservice.exe
PID 3824
TID 2596
User domainname\domainuser
Parent PID 3100
Operation CreateFile
Path \\server\folder1\folder2\file.ext
Result SHARING VIOLATION
Detail Desired Access: Generic Read, Dis, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a
According to ProcMon there is no other process on any of the servers accessing the file around the time the problem occurs. Our service was able to open and close the file shortly before the problem occurs.
Last action before ProcMon shows the sharing violation succeeds:
Date & Time: 12.03.2018 10:48:21,4164908
Event Class: File System
Operation: QueryDirectory
Result: SUCCESS
Path: \\server\folder1\folder2\file.ext
TID: 2596
Duration: 0.0000222
There is a KB article that referes to a similar issue and a fix for Windows Server 2008 R2:
support.microsoft.com/en-us/help/2625434
However, the fix cannot be installed on Window Server 2008 R2 (error during installation).
Is there any chance to dig deeper and find the cause of this problem?
Thanks in advance,
Andreas