for-win icon indicating copy to clipboard operation
for-win copied to clipboard

The process cannot access the file 'C:\WINDOWS\TEMP\<some file>' because it is being used by another process.

Open slafave opened this issue 9 years ago • 50 comments

Expected behavior

When starting machine, Docker should start normally.

Actual behavior

Docker icon indicates it's initializing. After several minutes I get the following exception. The filename is always different. The temp file indicated is always created at bootup, it's creation and modified date correspond to when I log into my machine after clean boot.

The process cannot access the file 'C:\WINDOWS\TEMP\kmrua3r5.sbk' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) at Docker.Backend.MobyCommand.RunDocker(String arguments, IDictionary2 envVariables, String stdin, Int32 timeoutMs, String cidFile) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\MobyCommand.cs:line 139 at Docker.Backend.MobyCommand.Run(String commandLine, IDictionary2 envVariables, Boolean load, String stdin, Int32 timeoutMs) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\MobyCommand.cs:line 49 at Docker.Backend.SambaShare.MountInMoby(String mount, String drive, Credential cred, CredentialInfo credInfo, String options, String ip) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 197 at Docker.Backend.SambaShare.MountInMoby(String drive, Credential credential, Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 168 at Docker.Backend.SambaShare.Mount(String drive, Credential credential, Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 65 at Docker.Backend.BackendServer.b__5_11(Object[] args) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\BackendServer.cs:line 54 at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 145

Information

  • Diagnostic ID: A5DA733E-F0E6-4FCE-9066-01021758BEA2/2017-06-13_09-28-37
  • Docker Edge Build 17.06.0-rc2-ce-win14 (12510)
  • Windows 10 Enterprise 1703, Build 15063.332

Steps to reproduce the behavior

  1. Cold boot Windows
  2. Docker crashes trying to access a locked temp file.

slafave avatar Jun 13 '17 13:06 slafave

Hi @slafave Do you have any antivirus or endpoint protection utilities running that would be scanning the windows\temp folder ?

jasonbivins avatar Jun 13 '17 19:06 jasonbivins

Hi @jasonbivins -

We're running Windows Defender but I have the Windows\Temp folder excluded from all scanning.

slafave avatar Jun 14 '17 13:06 slafave

For what it's worth, I've been getting this since loading Edge. Windows\Temp is not the best folder to exclude from AV scanning. I'm going to try setting an exclusion by process instead (Docker.Service). Will update this thread with results.

jasonterando avatar Jun 14 '17 18:06 jasonterando

So far, excluding the Docker.Service process from AV scanning appears to be preventing the TEMP error...

jasonterando avatar Jun 15 '17 21:06 jasonterando

Queue sad trombones, got the temp file access error again... Is there another process besides Docker.Service I can try excluding?

Crash report: C7ED5F5F-3273-4BDE-9A44-A018CA0CBD67/2017-06-18_09-54-59

Stack trace:

The process cannot access the file 'C:\WINDOWS\TEMP\iypofhvz.ase' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at Docker.Backend.MobyCommand.RunDocker(String arguments, IDictionary`2 envVariables, String stdin, Int32 timeoutMs, String cidFile) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\MobyCommand.cs:line 139
   at Docker.Backend.MobyCommand.Run(String commandLine, IDictionary`2 envVariables, Boolean load, String stdin, Int32 timeoutMs) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\MobyCommand.cs:line 49
   at Docker.Backend.SambaShare.MountInMoby(String mount, String drive, Credential cred, CredentialInfo credInfo, String options, String ip) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 197
   at Docker.Backend.SambaShare.MountInMoby(String drive, Credential credential, Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 168
   at Docker.Backend.SambaShare.Mount(String drive, Credential credential, Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 65
   at Docker.Backend.BackendServer.<Run>b__5_11(Object[] args) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\BackendServer.cs:line 54
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 145

jasonterando avatar Jun 18 '17 15:06 jasonterando

OK, I'm also affected by this issue. After a little bit of investigation, I doubt it's the AV. Here's my reasoning:

I'm running 17.06.0-ce-rc5-win16 (12604) on the Edge channel. Crash report: 7375E156-29B2-468B-9C4C-F8C65221B099/2017-06-27_09-37-38 Stack trace:

The process cannot access the file 'C:\WINDOWS\TEMP\w3mbvm1u.z2u' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at Docker.Backend.MobyCommand.RunDocker(String arguments, IDictionary`2 envVariables, String stdin, Int32 timeoutMs, String cidFile) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\MobyCommand.cs:line 139
   at Docker.Backend.MobyCommand.Run(String commandLine, IDictionary`2 envVariables, Boolean load, String stdin, Int32 timeoutMs) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\MobyCommand.cs:line 49
   at Docker.Backend.SambaShare.MountInMoby(String mount, String drive, Credential cred, CredentialInfo credInfo, String options, String ip) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 197
   at Docker.Backend.SambaShare.MountInMoby(String drive, Credential credential, Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 168
   at Docker.Backend.SambaShare.Mount(String drive, Credential credential, Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\SambaShare.cs:line 65
   at Docker.Backend.BackendServer.<Run>b__5_11(Object[] args) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\BackendServer.cs:line 54
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 145

Using Process Explorer (from the Sysinternals suite, https://technet.microsoft.com/en-us/sysinternals/bb842062.aspx), I searched for processes having open handles containing w3mbvm1u.z2u (from the Find -> Find Handle or DLL... menu). I found one docker.exe process (a child of the com.docker.service process) that was just sitting taking very little CPU (under 1% every now and then). This process has the command line:

"C:\Program Files\Docker\Docker\Resources\bin\docker.exe" run --rm --privileged --pid=host -i -e USER --cidfile="C:\WINDOWS\TEMP\w3mbvm1u.z2u" d4w/nsenter /bin/sh -c "export PASSWD=$(cat); if ! nc -zv -w1 10.0.75.1 445; then exit 253; fi; (umount -vl /c || true) && (umount -vl /C || true) && (rmdir /c || true) && (rmdir /C || true) && mkdir -p /c && mkdir -p /C && mount -t cifs //10.0.75.1/C /c -v -o noperm,iocharset=utf8,nobrl,mfsymlinks,vers=3.02,domain=upsilon&& mount -t cifs //10.0.75.1/C /C -v -o noperm,iocharset=utf8,nobrl,mfsymlinks,vers=3.02,domain=upsilon"

Once the stack trace window with the error is dismissed, I can successfully restart Docker (from the Reset tab of the settings dialog), and everything comes up as expected.

bribass avatar Jun 27 '17 17:06 bribass

That's the cifs-mount container. cc @simonferquel @ebriney

friism avatar Jun 27 '17 17:06 friism

Same error, right after the latest udpate.

NicolasDorier avatar Jun 29 '17 07:06 NicolasDorier

And I confirm, after the error windows, clicking Restart works.

NicolasDorier avatar Jun 29 '17 07:06 NicolasDorier

@gtardif - did this actually get fixed? @NicolasDorier just mentioned that he was still seeing the error after the current update, and that restarting Docker worked. The error, however, still exists.

jasonterando avatar Jun 29 '17 12:06 jasonterando

No it's not in the actual version. I'll be fixed in the next one, sorry for the convenience.

ebriney avatar Jun 29 '17 12:06 ebriney

My version is

Version 17.06.0-ce-win18 (12627)
Channel: stable
d9b6651

NicolasDorier avatar Jun 29 '17 12:06 NicolasDorier

I can report that this also went away for me with the latest update on edge, 17.06.0-ce-win17 (12626).

bribass avatar Jun 29 '17 16:06 bribass

For me this just started happening after a docker update to latest 17.06:

The process cannot access the file 'C:\WINDOWS\TEMP\0fq3fmla.c4l' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at Docker.Backend.MobyCommand.RunDocker(String arguments, IDictionary`2 envVariables, String stdin, Int32 timeoutMs, String cidFile)
   at Docker.Backend.MobyCommand.Run(String commandLine, IDictionary`2 envVariables, Boolean load, String stdin, Int32 timeoutMs)
   at Docker.Backend.SambaShare.MountInMoby(String mount, String drive, Credential cred, CredentialInfo credInfo, String options, String ip)
   at Docker.Backend.SambaShare.MountInMoby(String drive, Credential credential, Settings settings)
   at Docker.Backend.SambaShare.Mount(String drive, Credential credential, Settings settings)
   at Docker.Backend.BackendServer.<Run>b__5_11(Object[] args)
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)

Tried reset factory defaults, and this fixed it.

joelharkes avatar Jun 30 '17 06:06 joelharkes

I currently have Docker version 17.06.0-ce, build 02c1d87. And I have the same problem that the others mention. I see that they say that reestablishing the defaults is fixed, but in realizad I do not see it as a solution because this destroys all the containers I currently have. I hope you can support me with this inconvenience.

The process cannot access the file 'C:\Windows\TEMP\qxtcclj4.f0m' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) at Docker.Backend.MobyCommand.RunDocker(String arguments, IDictionary2 envVariables, String stdin, Int32 timeoutMs, String cidFile) at Docker.Backend.MobyCommand.Run(String commandLine, IDictionary2 envVariables, Boolean load, String stdin, Int32 timeoutMs) at Docker.Backend.SambaShare.MountInMoby(String mount, String drive, Credential cred, CredentialInfo credInfo, String options, String ip) at Docker.Backend.SambaShare.MountInMoby(String drive, Credential credential, Settings settings) at Docker.Backend.SambaShare.Mount(String drive, Credential credential, Settings settings) at Docker.Backend.BackendServer.b__5_11(Object[] args) at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)

jmanuelsoberano avatar Jul 02 '17 03:07 jmanuelsoberano

Im not sure if it destroys running contaiers. But you shouldn't even store Important state in your containers in the first place.

joelharkes avatar Jul 02 '17 06:07 joelharkes

Started happening after last update. Reset to defaults helps but after reboot it's not working again.

ikovalyov avatar Jul 02 '17 12:07 ikovalyov

Restart odkcer using gui helped.

ikovalyov avatar Jul 02 '17 13:07 ikovalyov

Still going on with the stable version: Version 17.06.0-ce-win18 (12627) Channel: stable d9b6651 Reset fixes the problem... Is there ETA on a Stable release fix for this?

oba2cat3 avatar Jul 04 '17 18:07 oba2cat3

gave docker-users permission to write into temp folder. works good for now.

ikovalyov avatar Jul 04 '17 19:07 ikovalyov