We're having weird issues for a while where some conversions aren't generated. Hard te reproduce because it doesn't happen every time. On a model we do have 3 conversions; mini, thumb and detail. Mini isn't queued and is always generated. The other 2 are queued. In code:
Does sometimes result in just {"mini": true} in the generated_conversions column instead of {"mini": true, "thumb": true, "detail": true}. The actual images aren't generated as well! Resulting in broken images in the frontend. In those cases the PerformConversionsJob job has a runtime of 0.00s in Horizon.
Running php artisan media-library:regenerate --only-missing does generate them but it should generate them directly.
Where kNCsZApUFbTIQTLlBnta7zVHdnkcVeEl and rRsK4aWDoYP7ZEGgV1Or9JuFoS29m6hM are used twice.
So getTemporaryDirectoryPath() isn't generating unique directories... can we make that truly unique somehow? Or should be check if it's the only file in directory and only delete it in that case?
We're having weird issues for a while where some conversions aren't generated. Hard te reproduce because it doesn't happen every time. On a model we do have 3 conversions; mini, thumb and detail. Mini isn't queued and is always generated. The other 2 are queued. In code:
This in combination with Laravel Horizon and
QUEUE_CONNECTION=redis
and multiple workers:Does sometimes result in just
{"mini": true}
in thegenerated_conversions
column instead of{"mini": true, "thumb": true, "detail": true}
. The actual images aren't generated as well! Resulting in broken images in the frontend. In those cases thePerformConversionsJob
job has a runtime of0.00s
in Horizon.Running
php artisan media-library:regenerate --only-missing
does generate them but it should generate them directly.I added some debugging and it seems like it's caused by a directory which is deleted which shouldn't happen. Related: https://github.com/spatie/laravel-medialibrary/pull/3630 but in another file; https://github.com/spatie/laravel-medialibrary/blob/bce761db9dc9d559365b256e98ad9bd5cef16192/src/Conversions/FileManipulator.php#L53 here the temp directory is created and the whole directory will be removed at the end: https://github.com/spatie/laravel-medialibrary/blob/bce761db9dc9d559365b256e98ad9bd5cef16192/src/Conversions/FileManipulator.php#L74
The temp directory should be unique: https://github.com/spatie/laravel-medialibrary/blob/bce761db9dc9d559365b256e98ad9bd5cef16192/src/Support/TemporaryDirectory.php#L19 but when I add some logging here: https://github.com/spatie/laravel-medialibrary/blob/bce761db9dc9d559365b256e98ad9bd5cef16192/src/Conversions/Actions/PerformManipulationsAction.php#L45 with
logger($conversionTempFile);
I'm getting:Where
kNCsZApUFbTIQTLlBnta7zVHdnkcVeEl
andrRsK4aWDoYP7ZEGgV1Or9JuFoS29m6hM
are used twice.So
getTemporaryDirectoryPath()
isn't generating unique directories... can we make that truly unique somehow? Or should be check if it's the only file in directory and only delete it in that case?To reproduce it simply use the same directory here: https://github.com/spatie/laravel-medialibrary/blob/bce761db9dc9d559365b256e98ad9bd5cef16192/src/Support/TemporaryDirectory.php#L19 with for example: