-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files locked in cache directory #525
Comments
@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: This is the php error message: |
Same issue here - locked files - not only with php. Unlocks them only after Docker Settings -> Reset. I`m also unable to do chmod or chown on any mounted volume files - no effect. Windows 10 Enterprise Docker Community Edition |
My colleague and i have the same problem. e.g: This file cannot be deleted. Wheter from Windows, nor inside any container (with root) Windows 10 Pro |
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. |
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:
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.
|
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. Once the files get locked, we have 4 strategies. Sometimes one works, sometimes does another:
I don't know what info we can provide that helps solving this issue. Cheers. |
Same issue here with Doctrine in docker (proxies folder). Docker for Windows 17.09.0-ce-win33 (13620) When I close the D4W app then the locked file disappears. |
Same here with Version 17.09.0-ce-win33 (13620) |
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) 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. |
I have a same problem with Docker for Windows, php-fpm, Doctrine and Symfony 3. |
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. |
I solved the issue using an internal directory created when building the container. I asume it can also be done using named volumes. |
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... |
/lifecycle frozen |
Encountering this problems in a php+nginx enviroment too. /remove-lifecycle stale |
To share some additional information on exactly what's causing this issue on my end:
This causes the given conflicted file to enter a state of existential crisis, where it's not modifiable by any user on the host OS. I believe, but I'm not 100% confident, that at the same time, the guest container considers that file handle "stale". Shutting down the Docker Desktop engine (and thus the Hyper-V VM) fixes the file's state and allows the host OS to modify it again. It isn't possible in my case to completely disable cron tasks, though for development purposes I have reduced their frequency in the hopes that this will reduce the overall amount of time that the possible lockout conflict exists. I have no idea what the underlying cause of this is, but I can reproduce it like clockwork on my end just by directly editing a file that the cron task is also reading at the same time, so if there's any debugging I can do, I'm happy to do so. This issue has plagued me for years and resulted in me going through a (very expensive) misadventure trying to find alternatives to Docker Desktop. |
still an issue |
When the files were locked, I managed to unlock them in Windows > Computer Management > Shared Folders > Open Files. Running the docker app as admin fixed the doctrine issue for me. |
In Doctrine also helps to set |
How do you run docker (desktop) as an admin? |
Open the start menu, right click on Docker Desktop > More > Run as Administrator. |
run docker as an admin doesn't solve the issue for me. |
Moving proxies files to /tmp (if /tmp is not binded to your computer) folder solves the problem. |
had the same issue, setting an absolute path made it work for us, e.g /var/www/html/doctrine_proxy/ |
running docker as admin doesn't seem to fix the issue |
I set it in the Doctrine PHP code config @mkuehnel $config->setProxyDir('/path/to/myproject/lib/MyProject/Proxies'); https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/advanced-configuration.html |
This is terrible. My macbook is having the battery replaced so I'm on my windows desktop for the first time in 2 years and Symfony was running extremely slow (30+ seconds per request), so I tried setting up docker. Spent half a day yesterday getting it running just to see slow speeds and now files that I can't remove from the Proxies folder without restarting my computer (the same issue as people above). I can't believe this hasn't been solved in 2 years.. |
FYI, if you don't use Doctrine PHP config, you can change the yaml file:
|
You can just set |
Thanks @digitalstraw - My main page was loading but ajax calls were failing without this, but now the initial page load times out. |
Hmmm...after a few refreshes I got this (I suspect I need to manually recreate my cache now? Trying that):
Gawd...just deleted my cache folder and it's 26.1 mb. |
Try to delete the cache and run again. If it does not help, consider installing APC extension and configure Doctrine like this:
|
@digitalstraw - Just restarted, cleared cache, turned off docker, and turned on WAMP. I don't think the issue is docker-specific.
|
It seems this issue has veered a bit from the initial problem. So, I'm happy to open another issue. In any case, I have recently had a couple different scenarios where lock files got permanently "stuck" unless docker for windows was stopped (even resetting didn't fix the issue as long as Docker was running). This happened twice with Git operations inside a container on a bind-mount, and once with my own lockfile (set from redis / rq) again on a bind-mounted directory. Any pointers on how to avoid this would be greatly appreciated. We can try to change how we do the lock in RQ, and could change the version of git we're using perhaps? |
@davclark My files get stuck always when I run one script operating over one set of filesystem files in several parallel instances/requests. Files get stuck, then. Not all, some of them. So maybe if you avoid parallel access to one file, you might avoid this... |
I get similar issues when trying to npm install. Oddly this didn't appear until the past several weeks. This seems part of to be a whole family of problems with LCOW that surface after some update or another and not really related to Docker Desktop. |
Thanks @digitalstraw - though I am a bit loathe to patch both git and redis/rq to change their file locking behavior! |
I saw that 2.2.3.0 had a bunch of changes to bind mounts. But I didn't see anything regarding this issue. Are there any updates in that 2.2.3 or the near future? The urgency of this issue goes up now that WSL2 is the default in 2.2.3 - which I think means that stable channel gets WSL2 as default in June. |
Same exact issue but on OSX. Similarly restarting docker fixed it. |
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
Steps to reproduce the behavior
The text was updated successfully, but these errors were encountered: