Description
Symfony version(s) affected: 3.4.11
Description
If you invoke the Filesystem remove() method on a directory multiple times concurrently, it can fail on certain filesystems with the error:
Failed to remove directory "/home/foo/.drush/cache/bar": rmdir(/home/foo/.drush/cache/bar): Directory not empty
How to reproduce
I'm currently regularly encountering this using Drush and a Gluster filesystem. I have a script that calls drush cc drush
, which invokes remove() on a directory that's hosted on Gluster.
Here's where Drush calls remove(): https://github.com/drush-ops/drush/blob/0e2abf43ad0d2f398a7afb23772c556a906d840d/src/Cache/FileCache.php#L132
When my script runs multiple times in parallel, it frequently fails with the above error.
I'm not totally sure if this is due to a race condition with Gluster, or if it's a race condition within Symfony that only becomes apparent when disk i/o is heavily throttled (as on a shared filesystem).
I've also seen this happen (albeit somewhat less frequently) on a mounted EC2 filesystem, so it's not just a Gluster problem.
Other folks have reported similar issues running Symfony's internal cache clear on shared filesystems, although I don't know if they were running cache clears concurrently: #2600