for-win
for-win copied to clipboard
Files locked in cache directory
Expected behavior
Process should have write permission to a cache directory and all its sub-directories)
Actual behavior
When I start a container to run PHP FPM to serve Symfony2 some files in the cache directory are locked and the process cannot write in them. No way to remove remove the files (inside the container, in Windows using file explorer or Powershell, even when using Administrator privilege). When I stop Docker then I can remove the locked files. For those familiar with Symfony2, this happens when Doctrine generates entity proxy class in temporary file and tries to rename it.
Information
- Diagnostic ID: 1979D450-9549-4EDF-B258-1147D0CFAA65/2017-02-23_12-35-23
- host distribution and version: OS: Windows 10 Enterprise Id: 1511 Build: 10586
Steps to reproduce the behavior
- ...
- ...
@seydu Would you have a compose file we could use to reproduce the issue?
+1 I have tried several ways to solve this but to no avail. I believe it is permission related:
I have added RUN usermod -u 1000 www-data to the dockerfile, and manually set the permissions on the storage folder inside the container but neither of these measures have solved it. Any help here would be much appreciated.
This is the php error message:
"rename(/opt/app/storage/proxies/__CG__DomainEntitiesOrganisation.php.58b29056532943.69863232,/opt/app/storage/proxies/__CG__DomainEntitiesOrganisation.php): No such file or directory"
Same issue here - locked files - not only with php. Unlocks them only after Docker Settings -> Reset. Can also cause very strage behavior in combination with git .. e.g. unable to checkout files, rm, reset etc.
I`m also unable to do chmod or chown on any mounted volume files - no effect. This can be very frustrating for some setups.
Windows 10 Enterprise Microsoft Windows [Version 10.0.14393]
Docker Community Edition Version 17.03.1-ce-win5 (10743) Channel: stable b18e2a5
My colleague and i have the same problem.
e.g:
/var/cache/dev/twig/19/199fa6689b84659fb14bddcbeec7d0ea05230a4bf173fdf13fb488dc4b5642db.php
This file cannot be deleted. Wheter from Windows, nor inside any container (with root)
Windows 10 Pro Docker Community Edition Version 17.03.1-ce-win5 (10743) Channel: stable b18e2a5
Same Here. It isn't super predictable or replicateable yet. But when building Magento2 sites in my local we have to often clean the pub directory and eventually each day the files will get locked and I have to restart docker to free them so I can delete and continue my work. Windows 10 Pro Docker w Moby VM Version 17.03.1-ce-win12 (12058)
Having exactly the same problem here. Problem occurs randomly to files generated by Doctrine, which are re-created on each request.
Windows 10 Pro with the latest Docker version
I have the same problem. Even after the container is killed, I must reset whole Docker to unlock the file.
Windows 10 Pro + the latest Docker version.
Also have this problem - npm creating locked files on the Windows Host. Can this be worked around with Docker Toolbox in the meantime?
I have this issue too, in my case symfony can't rename or delete old doctrine cache fiel located in /var/www/symfony/var/cache/dev/doctrine/orm/Proxies/ locking all the project, only reboot helps, or changing cache directory to /tmp for example
I'm getting the same issue with the same setup. Any ETA on a possible fix? I've come to a dead end at the project I'm working on because the ProxyGenerator is producing files that can't be changed or removed. Here's my logs:
Warning: rename(/var/www/project/app/cache/dev/doctrine/orm/Proxies/__CG__AppBundleEntityAddressCurrent.php.5975ffd4a9d748.71864046,/var/www/project/app/cache/dev/doctrine/orm/Proxies/__CG__AppBundleEntityAddressCurrent.php): No such file or directory
1. in vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php at line 306
304 file_put_contents($tmpFileName, $proxyCode);
305 @chmod($tmpFileName, 0664);
306 rename($tmpFileName, $fileName);
307 }
To add, the only way for me to remove the cache folder is the same as mrAndersen said above, by renaming the folder and then deleting it.
Same here.
The issue show up when concurrent requests are called.
I run Docker for Windows with administrator privilege.
Windows 10 Pro
Docker Community Edition Version 17.07.0-ce-rc1-win21 (12927)
Same exact problem here. Have verified that no other processes (backup tasks, etc) are accessing the files in the volume shared with the Docker container, and yet seemingly at random, files are being locked in very strange ways on the Windows host OS.
I had more than one case where the file appeared to Windows to have no owner information and to be unmodifiable, and only removing the Docker containers resolved the issue. Some other cases, the file just cannot be written to, but no explanation is given. Each situation is resolved completely by fully shutting down and removing the Docker containers.
I never encountered similar issues using Docker Toolbox and Virtualbox.
I (and a lot of my co-workers) have the same issue. We are also using doctrine. What I could get from all the cases we have of the problem, is that when two or more requests run at the same time, doctrine tries to generate those proxy files. Somehow, those processes collide trying to remove the proxy or one tries to delete the file and the other to access it. It happens more consistently when the parallel requests are ajax (no so sure why).
Once the files get locked, we have 4 strategies. Sometimes one works, sometimes does another:
- Stop and up the containers.
- Restart docker.
- Delete the HyperV VM and restart docker.
- Restart the PC (sometimes this does not even work)
I don't know what info we can provide that helps solving this issue. We are using Win10 Pro 64bits. Docker Comunity Edition 17.x (we have had this issue since version 12 or 13 I think)
Cheers.
Same issue here with Doctrine in docker (proxies folder).
Docker for Windows 17.09.0-ce-win33 (13620) Windows 10 Pro 1703
When I close the D4W app then the locked file disappears.
Same here with npm install - files in .bin folder becomes locked, only Docker engine restart helps.
Version 17.09.0-ce-win33 (13620) Channel: stable 8c56a3b
Appears mostly when I send 2+ concurent requests to the webserver (eg. AJAX calls).
@dgageot What info is needed that we can provide for the issue to advance...
Thanks!
I'm guessing this happens for files that are bind-mounted from your Windows host into Docker containers?
If that's the case, you can maybe find a way to have the problematic files not be mapped to the Windows host and instead just be in the container or in a named volume (which won't touch the Windows filesystem).
As we make the transition to LCOW, we'll get a new and improved bind-mounting implementation: https://blog.docker.com/2017/09/preview-linux-containers-on-windows/
As that solution matures, you should check the behavior there, and we can work with Microsoft to fix things that are broken.
Same problem here with Symfony 3 and concurrent calls (REST API) Some proxy files from doctrine are locked and not writeable ...
After a reboot of Docker i can remove the files
Same issue with Doctrine Proxies files getting locked. After restarting Docker for Windows files can be removed but the issue persists. Only workaround is to move proxy_dir out of the mounted project, ie. /tmp http://symfony.com/doc/3.3/reference/configuration/doctrine.html#doctrine-orm-configuration
I have a same problem with Docker for Windows, php-fpm, Doctrine and Symfony 3. Doctrine proxies in cache directory getting locked and remain locked until a Docker restart occurs.
I'm having this same problem. We have a web application with nginx and it seems the most noticeable when switching branches with git (since it changes some files that are locked). It definitely seems like the problem gets worse when I start refreshing the site more causing some concurrency. I can confirm it clears the locks if I do docker-compose down and docker-compose up -d.
My only solution right now is before switching branches, clear all locked files via: Computer Management > System Tools > Shared Folders > Open Files > right click - disconnect all open files. You'll see all the files that are locked on this page and can clear them all easily without having to do down/up.
I'm not sure where to go from here but this problem is affecting everyone that works on this project, and with all the comments on this issue it definitely can't be an isolated incident.
Same problem here. Can't generate doctrine proxies on docker runingo on windows 10. One year have passed since OP added this ticket and still not resolved...
I solved the issue using an internal directory created when building the container. I asume it can also be done using named volumes. That works... if you don't need to have direct access to the generated files. Since my problem was with Doctrine proxies, it works just fine leaving them inside the container.
Same problem, usually when a long-running script is executing in my browser, and I try to do some Git actions (checkout, merge). The file will be in a weird state, readonly, can't delete, can't read. The only way is to completely exit Docker. On Windows.
Same here on windows, we have a quite big script that rebuilds a lot of files, and sometimes it cannot delete a few of them, and my software just crashes. Even from windows, it is impossible to delete it, I have to reboot docker for windows and the file is then automatically deleted.
I can see that this issue has been open for more than a year now, is someone working on it? It is too much time-consuming for us, I seriously consider dropping docker and advising my team to go for another solution...
@chris-cacciatore @SeBsZ I've found a "solution" that will help mitigate the problem until something can be truly done to fix it. This only works on Windows: Open Computer Management, navigate to Shared Folders then Open Files, right click anywhere in the open files area and choose "Disconnect All Open Files." I don't remember where I ended up finding this but it has worked well and a much better option than restarting Docker/Windows entirely.
@darinrandal thanks, I will try that!
@chris-cacciatore I also need to add that this only works on the latest version of Docker, the one that utilizes the tray icon (not the Docker Quickstart Toolbox terminal one). Not sure why, but they seem to handle the files differently. Maybe it's because the newer version actually requests permission to share the drive whereas the older one does not.
I have since switched to Mac and I'm happy to note I have no issues with Docker anymore, presumably due to Mac's unix-like nature. This is with the same docker containers that gave me plenty of headache on Windows.
Hi, I have the same problem on my side with files locked on Docker / Windows 10. Did someone find a solution ? Thanks.