Closed fleaz closed 3 years ago
@fleaz What Craft version are you using? As of Craft 3.4.16, all of the exceptions should be caught.
I just checked a few of our customers where we see this behavior and we run 3.4.21, 3.4.30 and 3.6.18
Can you post the full stack trace, please?
Yes of course. This is from the customer where we run 3.6.18
ErrorException: Warning: unlink(/mnt/customername/htdocs/storage/runtime/assets/sources/2828586.jpg): No such file or directory
#14 /mnt/customername/htdocs/vendor/yiisoft/yii2/helpers/BaseFileHelper.php(416): yii\helpers\BaseFileHelper::unlink
#13 /mnt/customername/htdocs/vendor/craftcms/cms/src/helpers/FileHelper.php(439): craft\helpers\FileHelper::unlink
#12 /mnt/customername/htdocs/vendor/craftcms/cms/src/services/AssetTransforms.php(1064): craft\services\AssetTransforms::getLocalImageSource
#11 /mnt/customername/htdocs/vendor/craftcms/cms/src/services/Assets.php(749): craft\services\Assets::getThumbPath
#10 /mnt/customername/htdocs/vendor/craftcms/cms/src/controllers/AssetsController.php(1130): craft\controllers\AssetsController::actionThumb
#9 [internal](0): call_user_func_array
#8 /mnt/customername/htdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): yii\base\InlineAction::runWithParams
#7 /mnt/customername/htdocs/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\Controller::runAction
#6 /mnt/customername/htdocs/vendor/craftcms/cms/src/web/Controller.php(190): craft\web\Controller::runAction
#5 /mnt/customername/htdocs/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Module::runAction
#4 /mnt/customername/htdocs/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application::runAction
#3 /mnt/customername/htdocs/vendor/craftcms/cms/src/web/Application.php(591): craft\web\Application::_processActionRequest
#2 /mnt/customername/htdocs/vendor/craftcms/cms/src/web/Application.php(257): craft\web\Application::handleRequest
#1 /mnt/customername/htdocs/vendor/yiisoft/yii2/base/Application.php(392): yii\base\Application::run
#0 /index.php(22): null
It all sounds a bit suspicious. Can you, please, send over your composer.lock file as well as the following files:
/vendor/craftcms/cms/src/helpers/FileHelper.php
/vendor/yiisoft/yii2/helpers/BaseFileHelper.php
I appreciate the relative sensitiveness of the composer.lock
file, so feel free to email that to support@craftcms.com and reference this issue!
The lockfile is on it's way via email.
Thanks for looking into this! :)
Alright, I just fixed this for the next release. This hadn't come to our attention, because the exception thrown by Yii is caught by Craft. With the Sentry plugin, however, it intercepts the exception before Craft can see it and decide to do nothing about it.
From now on, Craft will just make sure a file exists before trying to delete it.
Craft 3.7.15 is out now with the fix for this.
Awesome! Thank you both for fixing this :)
Description
Hey,
we run all our CraftCMS installations on AWS therefore we use S3 as our asset storage and deliver them directly via Cloudfront out of the bucket. Hence we don't need any of the images on the server and have set
maxCachedCloudImageSize
to 0 to never save any originals on the server itself so we don't have to provision them with a lot of storage. The problem resulting out of this setup is that we get A LOT of PHP exceptions from thegetLocalImageSource()
function in AssetTransforms.php because there is anunlink()
at the beginning that always want's to delete the file but the file never exists in our setup so unlink throws an exception (which really hurts us because we use Sentry to track our exceptions and 99,5% of the related to this).Let me know if you need anything else from me :)
Best, Felix
Steps to reproduce
Additional info