Replies: 5 comments
-
I'm having the same problem . I use MinIO as my object storage and the file uploads works perfectly fine but confersion jobs always fails because of FileNotFoundException . and I check my storage dashboard and see that the file exists and retry the job but again it cannot find the file although my bucket is set to public ... |
Beta Was this translation helpful? Give feedback.
-
With remote file systems, there are some specific error conditions. And they are more likely. I am writing about problems on the local file system where the cause seems to be a bug in media library itself. I would rather not confuse issues of remote file systems with my issue. |
Beta Was this translation helpful? Give feedback.
-
@LMCom Did you tried this? https://laravel.com/docs/10.x/queues#jobs-and-database-transactions Are you sure it fails because the file does not exist (yet) or that the database isn't synced yet? |
Beta Was this translation helpful? Give feedback.
-
Thank you for caring. No, the problem does not seem to be a transaction, I checked that already. Also, that should lead to an Also note that I added some new info to my post: "If that rare error occurs, the path to the file logo.png is created but the file itself is missing." |
Beta Was this translation helpful? Give feedback.
-
@LMCom Ok, another thing, what kind of queue driver are you using? I solved my issues by using Are you sure you're not getting double jobs? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am finding some failed jobs in
failed_jobs
that tell me about aLeague\Flysystem\FileNotFoundException
. This happens in less than 1 % of cases, I estimate. Whenever I try to reproduce this bug, there is no Exception.The code to generate a file and make the conversions:
While the conversions are done by a queued job, my understanding is that the following part should always happen sequentially:
So the file should always have been created successfully before the conversion starts.
The last method of laravel-medialibrary being called is
Spatie\MediaLibrary\MediaCollections\Filesystem->getStream()
, then the code ofLeague\Flysystem
takes over and notices that the file does not exist.Based on these observations, my best guess is that the creation of
logo.png
sometimes fails and laravel-medialibrary fails to notice that and proceeds. That is quite surprising, because\Spatie\MediaLibrary\MediaCollections\FileAdder->toMediaCollection()
checks for the existence of the file:However, the Exception
FileDoesNotExist
is never thrown and the code runs intoLeague\Flysystem\FileNotFoundException
when trying to process the file of theMedia
model.Edit: If that rare error occurs, the path to the file
logo.png
is created but the file itself is missing. I find this remarkable.My code is not manipulating the files in any way or interfering with the process. It's all happening inside the black box of laravel-medialibrary, and I have not been able to ultimately track down the root cause.
Here is the relevant part of the log from
failed_jobs
:Beta Was this translation helpful? Give feedback.
All reactions