google-api-php-client
google-api-php-client copied to clipboard
Text file busy when removing unused services using the cleanup class
Environment details
- OS: Ubuntu 22.04
- PHP version: 8.1
- Package name and version: v2.15.1
Steps to reproduce
- Install client
composer require google/apiclient:^2.15.0 - Add the cleanup scripts
"scripts": { "pre-autoload-dump": "Google\\Task\\Composer::cleanup" }, "extra": { "google/apiclient-services": [ "ShoppingContent", ] } - Run
composer update
Code example
composer update
Exception Example
Script Google\Task\Composer::cleanup handling the pre-autoload-dump event terminated with an exception
In Filesystem.php line 200:
Failed to remove directory "(/path/to/project/vendor/google/apiclient-services/src/._Mj2": rmdir(/path/to/project/vendor/google/apiclient-services/src/._Mj2): Text file busy
See #2504 and https://github.com/googleapis/google-api-php-client/pull/2532
I have tried this fix previously ,and again just now, in case @bshaffer but the issue still occurs. It doesn't appear to be an issue with composer timing as the dump takes a minute or 2, it just seems to be tripping up when deleting the unused services.
The script seems to rename the google/api-client-services/[DIR] folder first then start unlinking files with no issue, but gets stuck removing the Resource folder in the API service and that appears to be what's throwing the Text file busy error.
@mathewberry thanks for the feedback, then honestly I'm not sure what could be causing the problem. It could be something wrong with the order things are being removed by the symfony Filesystem component?
One thing I noticed here is you're receiving the error for a ._Mj2 file. I'm not sure where those are coming from, but they're not distributed as part of our package. This could be the problem.
Because we haven't received an update on this, I'm closing it for now. Please reopen it or submit a new issue if you continue to have this problem.
@bshaffer I think this can stay closed, but for any update for anyone that comes across this. If you're using Windows with Virtualbox and Vagrant, the way Vagrant maps folders between the virtual environment and the physical Windows host, there can be significant lag which causes the "Text File Busy" error.
It seems to have stopped in google/apiclient v2.15.3 for myself, it could also be due to numerous factors however so I can't guarantee this will work for anyone else experiencing it.